home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / fish / 726-750 / 740 / klondike / klondike v1.3.s < prev    next >
Text File  |  1995-03-18  |  96KB  |  5,194 lines

  1. *****************************************************************************
  2. *                                                                           * 
  3. *           __ __   __                   __ __ __                           *
  4. *          / // /  / /                  / //_// /__                         *
  5. *         / // /  / /______ ______ ____/ /__ / // / ___                     *
  6. *        / _  |  / // __  // __  // __  // // _  / / o \                    *
  7. *       / / | | / // /_/ // / / // /_/ // // /| | / ___/                    *
  8. *      /_/  |_|/_//_____//_/ /_//_____//_//_/ |_| \____/   Version 1.3      *
  9. *                                                                           *
  10. *                                                                           * 
  11. *  You may modify this source code for personal use ONLY ! You must NOT     *
  12. *  distribute modified versions of Klondike without my written permission.  *
  13. *                                                                           *
  14. *  If any major alterations are made to this code then please send a copy   *
  15. *  of the new source to the author, Peter Wiseman at :                      *
  16. *                                                                           * 
  17. *  30 Coronation Drive, Penketh, Warrington, Cheshire, WA5 2DD, ENGLAND     *
  18. *                                                                           * 
  19. *  and I'll consider releasing the mods (with credit) in a future version.  *
  20. *                                                                           *
  21. *                                                    (Pete 9th Sept 1992)   *
  22. *                                                                           *
  23. *****************************************************************************
  24.  
  25.  
  26.  
  27. ** This source was written for use with the Hisoft Devpac assembler **
  28.  
  29.  
  30. ** Modified 3/8/90 to V1.1 to cope with FastMem **
  31.  
  32. ** Modified 31/3/91 to V1.1b to enable it to run without extra commands in
  33. ** the C directory. Number of games played and reset hi-scores also added.
  34. ** In V1.1 you could place a column of cards on the foundations - this
  35. ** bug has been removed in V1.1b **    
  36.  
  37. ** Modified yet again April 1991 to V1.2 : Merge Hi-Scores & Help menu
  38. ** versions menu and all known bugs fixed
  39. ** New hi-score of 11449 to beat (Genuine - Honest !) **
  40.  
  41. ** 24th September 1991 - V1.21 fixes a bug in V1.2
  42. ** Game End menu was being disabled when the menu bar was removed
  43. ** This caused the game to crash occasionally on completing the game
  44.  
  45. ** 17th December 1991 - Jerky card movement with my GVP hard drive !
  46. ** The old "flyback" routine has now been altered to use the system
  47. ** routine WaitBOVP and this has fixed the problem (V1.22)
  48.  
  49. ** 3rd September 1992 - V1.3 card graphics menus added & a bug fixed **
  50.  
  51.  
  52.     incdir ":include/"
  53.  
  54.     include "exec/exec_lib.i"
  55.     include "intuition/intuition_lib.i"
  56.     include "libraries/dos_lib.i"
  57.     include "graphics/graphics_lib.i"
  58.     include "libraries/dosextens.i"
  59.     include "libraries/dos.i"
  60.     include "workbench/startup.i"
  61.  
  62. snd0        equ 128        * ( Pointers )
  63. snd1        equ 4840
  64. snd2        equ 5078
  65. snd3        equ 1210
  66. snd4        equ 2550
  67. snd5        equ 19656
  68. soundsize    equ snd0+snd1+snd2+snd3+snd4+snd5
  69. cardmem        equ 8*46*3*56
  70. tablemem    equ 64*10
  71. hiscrsize    equ 500
  72. down         equ 20
  73. cardx        equ 33        
  74. cardy        equ 140
  75. maxscrheight    equ 258        * display size
  76. deck1x        equ 244        * x position of face down deck
  77. deck2x        equ 318        * x position of face up deck
  78. foundx1        equ 79        * x position of 1st foundation card
  79. foundx2        equ 441        * x position of 3rd foundation card
  80. gap2        equ 11        * pixels between deck face up cards
  81. maxplane    equ (17*7+56)*10    * (17*gap+56)*10
  82. maxname        equ 16        * Maximum number of letters for graphics filenames
  83.  
  84.     move.l a7,stack
  85.     sub.l a1,a1
  86.     CALLEXEC FindTask
  87.     move.l d0,a4
  88.     tst.l pr_CLI(a4)
  89.     bne CLI
  90.     lea pr_MsgPort(a4),a0
  91.     CALLEXEC WaitPort
  92.     lea pr_MsgPort(a4),a0
  93.     CALLEXEC GetMsg
  94.     move.l d0,_WBenchMsg
  95.  
  96. ** Open DOS library **
  97.  
  98.     move.l #dosname,a1
  99.     clr.l d0
  100.     CALLEXEC OpenLibrary
  101.     tst.l d0
  102.     beq end
  103.     move.l d0,_DOSBase
  104.     move.l _WBenchMsg,a2
  105.     move.l sm_ArgList(a2),d0
  106.     beq nodir
  107.     move.l d0,a0
  108.     move.l wa_Lock(a0),d1
  109.     CALLDOS CurrentDir
  110. nodir    bra nextlib
  111.  
  112. CLI    
  113. ** Open DOS library **
  114.  
  115.     move.l #dosname,a1
  116.     clr.l d0
  117.     CALLEXEC OpenLibrary
  118.     tst.l d0
  119.     beq end
  120.     move.l d0,_DOSBase
  121.  
  122. nextlib
  123.  
  124. ** Open Graphics library **
  125.  
  126.     move.l #grafname,a1
  127.     clr.l d0
  128.     CALLEXEC OpenLibrary
  129.     tst.l d0
  130.     beq closedos
  131.     move.l d0,_GfxBase
  132.  
  133.  
  134. ** Open Intuition library **
  135.  
  136.     move.l #intname,a1
  137.     clr.l d0
  138.     CALLEXEC OpenLibrary
  139.     tst.l d0
  140.     beq closegraf
  141.     move.l d0,_IntuitionBase
  142.  
  143. * Open audio device *
  144.  
  145.     move.l #device,a0
  146.     move.l #iorequest,a1
  147.     clr.l d1
  148.     CALLEXEC OpenDevice
  149.     tst.l d0
  150.     bne closeint
  151.  
  152. ** Find this task **
  153.  
  154.     sub.l a0,a0
  155.     CALLEXEC FindTask
  156.     move.l d0,task
  157.  
  158. ** Allocate a signal bit **
  159.  
  160.     move.l #-1,d0
  161.     CALLEXEC AllocSignal
  162.     btst #7,d0
  163.     bne closeaudio
  164.     move.b d0,signal
  165.  
  166. ** Open custom hi-res screen **
  167.  
  168.     move.l #newscreen,a0
  169.     CALLINT OpenScreen
  170.     tst.l d0
  171.     beq freesignal
  172.     move.l d0,screen
  173.     move.l d0,a0    
  174.     add.w #$2c,a0        * sc_Viewport
  175.     move.l a0,viewport
  176.     add.w #$b8-$2c,a0    * sc_Bitmap
  177.     move.l a0,bitmap
  178.     move.l (a0),bitmap2
  179.     move.l 4(a0),bitmap2+4
  180.  
  181.     bsr setcols        * Blank out display
  182.  
  183.  
  184. ** Open a full screen size window **
  185.  
  186.     move.l #newwindow,a0
  187.     CALLINT OpenWindow
  188.     tst.l d0
  189.     beq closescreen
  190.     move.l d0,window
  191.     move.l d0,a0
  192.     move.l $32(a0),rastport
  193.     move.l $56(a0),userport
  194.  
  195.  
  196. ** Allocate memory for 54 full size cards **
  197.  
  198.     move.l #cardmem,d0
  199.     move.l #$10003,d1
  200.     CALLEXEC AllocMem
  201.     tst.l d0
  202.     beq closewindow
  203.     move.l d0,cardmemory
  204.     add.l #46*8*3*54,d0
  205.     move.l d0,cardmask
  206.     add.l #46*8,d0
  207.     move.l d0,cardmask2
  208.  
  209. ** Allocate memory for card table **
  210.  
  211.     move.l #tablemem,d0
  212.     move.l #65537,d1
  213.     CALLEXEC AllocMem
  214.     tst.l d0
  215.     beq freecardmem
  216.     move.l d0,tablememory
  217.  
  218. ** Allocate memory for move card graphics **
  219.  
  220.     move.l #maxplane*4,d0
  221.     move.l #$10002,d1
  222.     CALLEXEC AllocMem
  223.     tst.l d0
  224.     beq freetablemem
  225.     move.l d0,movememory
  226.  
  227. ** Allocate memory for tempory 3 bitplane screen **
  228.  
  229.     move.l #bitmap2+8,a5
  230.     move.w #2,d7
  231. nextrast move.l #80*maxscrheight,d0
  232.     move.l #$10002,d1
  233.     CALLEXEC AllocMem
  234.     tst.l d0
  235.     beq freerastermem
  236.     move.l d0,(a5)+
  237.     dbf d7,nextrast
  238.  
  239. ** Allocate memory for hi-scores **
  240.  
  241.     move.l #hiscrsize,d0
  242.     move.l #$10000,d1
  243.     CALLEXEC AllocMem
  244.     tst.l d0
  245.     beq freerastermem
  246.     move.l d0,himem
  247.  
  248. ** Allocate memory for 2nd rastport **
  249.  
  250.     move.l #100,d0
  251.     move.l #$10002,d1
  252.     CALLEXEC AllocMem
  253.     tst.l d0
  254.     beq freehimem
  255.     move.l d0,rastport2
  256.     move.l d0,a1
  257.     CALLGRAF InitRastPort
  258.     move.l rastport2,a0
  259.     move.l #bitmap2,4(a0)
  260.  
  261. ** Allocate memory for sounds **
  262.  
  263.     move.l #soundsize,d0
  264.     move.l #$10002,d1
  265.     CALLEXEC AllocMem
  266.     tst.l d0
  267.     beq freerastport
  268.     move.l d0,soundmem
  269.  
  270. ** Load sounds file onto custom screen **
  271.  
  272.     bsr loadsounds
  273.     tst.l d0
  274.     bne freesoundmem
  275.  
  276.     bsr loadscores
  277.     move.l screen,a0
  278.     CALLINT ScreenToFront
  279.  
  280. ** Search for card graphics and create submenus for them **
  281.  
  282.     bsr graphicsmenus
  283.     tst.l d7
  284.     beq freesoundmem
  285.  
  286.     bsr cls
  287.     bsr setupgfx
  288.     tst.l d0
  289.     beq freesoundmem
  290.  
  291.     move.l himem,a4
  292.     btst.b #1,270(a4)
  293.     bne setNTSC
  294.     move.w #ITEMTEXT+HIGHCOMP+ITEMENABLED+CHECKIT+CHECKED,opt1
  295.     move.w #ITEMTEXT+HIGHCOMP+ITEMENABLED+CHECKIT,opt2
  296.     bra donePAL
  297. setNTSC    move.w #ITEMTEXT+HIGHCOMP+ITEMENABLED+CHECKIT+CHECKED,opt2
  298.     move.w #ITEMTEXT+HIGHCOMP+ITEMENABLED+CHECKIT,opt1
  299. donePAL    btst.b #0,270(a4)
  300.     bne bnw2
  301.     bsr setcols
  302.     move.w #ITEMTEXT+HIGHCOMP+ITEMENABLED+CHECKIT+CHECKED,opt3
  303.     move.w #ITEMTEXT+HIGHCOMP+ITEMENABLED+CHECKIT,opt4
  304.     bra fullcol
  305. bnw2    move.l #cols2,a1
  306.     bsr setbnw
  307.     move.w #ITEMTEXT+HIGHCOMP+ITEMENABLED+CHECKIT+CHECKED,opt4
  308.     move.w #ITEMTEXT+HIGHCOMP+ITEMENABLED+CHECKIT,opt3
  309.  
  310. fullcol    move.w 270(a4),oldstatus
  311.     bsr setmonitor
  312.     
  313.     bsr pointcols
  314.     bsr pointer1    
  315.     move.l window,a0
  316.     move.l #klondike,a1
  317.     CALLINT SetMenuStrip
  318.     bra dontdoscoresagain
  319.  
  320. ****** E V E R Y   E N D   O F   G A M E ******
  321.  
  322. beginning bsr printhiscores
  323. dontdoscoresagain move.l window,a0
  324.     move.w #33,d0
  325.     CALLINT OffMenu        * "End game"
  326.  
  327.     move.l window,a0
  328.     move.w #1,d0
  329.     CALLINT OnMenu        * "New game"    
  330.  
  331.     move.l window,a0
  332.     move.w #$02,d0
  333.     CALLINT OnMenu        * "PAL"
  334.  
  335.     move.l window,a0
  336.     move.w #$22,d0
  337.     CALLINT OnMenu        * "NTSC"
  338.  
  339.     move.l window,a0
  340.     move.w #$f882,d0
  341.     CALLINT OnMenu        * "Face Graphics"
  342.  
  343.     move.l window,a0
  344.     move.w #$f8a2,d0
  345.     CALLINT OnMenu        * "Back Graphics"
  346.  
  347.     move.l window,a0
  348.     move.w #$f8c2,d0
  349.     CALLINT OnMenu        * "Symbols Graphics"
  350.  
  351.     move.l window,a0
  352.     move.w #$e2,d0
  353.     CALLINT OnMenu        * "Merge Hi-Scores"
  354.  
  355.     move.l window,a0
  356.     move.w #$f902,d0
  357.     CALLINT OnMenu        * "Reset Scores"
  358.  
  359.  
  360. menuwait bsr testmenus
  361.     bra menuwait
  362.  
  363. testmenus move.l userport,a0
  364.     CALLEXEC GetMsg    
  365.     tst.l d0
  366.     bne gotmsg
  367. return    rts    
  368. gotmsg    move.l d0,a1
  369.     move.l $14(a1),d4
  370.     move.w $18(a1),d5
  371.     CALLEXEC ReplyMsg
  372.     cmp.w #$0100,d4    * MENUPICK
  373.     bne return
  374.     cmp.w #$ffff,d5    * MENUNULL
  375.     beq return
  376.     move.w d5,d6
  377.     and.w #$7ff,d5
  378.     cmp.w #$60,d5
  379.     beq quit
  380.     cmp.w #$20,d5
  381.     beq versions
  382.     cmp.w #$40,d5
  383.     beq credits
  384.     cmp.w #1,d5
  385.     beq newgame
  386.     cmp.w #$21,d5
  387.     beq endgame
  388.     cmp.w #$02,d5
  389.     beq doPAL
  390.     cmp.w #$22,d5
  391.     beq doNTSC
  392.     cmp.w #$62,d5
  393.     beq bnw
  394.     cmp.w #$42,d5
  395.     beq colour
  396.     cmp.w #$e2,d5
  397.     beq mergethem
  398.     cmp.w #$102,d5
  399.     beq resetscores
  400.     cmp.w #$03,d5
  401.     beq dohelp1
  402.     cmp.w #$23,d5
  403.     beq dohelp2
  404.     cmp.w #$43,d5
  405.     beq dohelp3
  406.     cmp.w #$63,d5
  407.     beq dohelp4
  408.     cmp.w #$82,d5
  409.     beq dofaces
  410.     cmp.w #$a2,d5
  411.     beq dobacks
  412.     cmp.w #$c2,d5
  413.     beq dosymbols
  414.     tst.w d5
  415.     beq doabout
  416.  
  417.     rts
  418.  
  419. dofaces    move.w #278,d0
  420.     bra transf
  421. dobacks    move.w #311,d0
  422.     bra transf
  423. dosymbols move.w #344,d0
  424.  
  425. transf    move.l himem,a5
  426.     add.w d0,a5
  427.  
  428.     clr.l d0
  429.     move.w d6,d0
  430.     move.l #klondike,a0
  431.     CALLINT ItemAddress
  432.  
  433.     move.l d0,a0
  434.     move.l 18(a0),a0
  435.     move.l 12(a0),a0
  436.     add.w #2,a0
  437. bungin    move.b (a0)+,(a5)+
  438.     bne bungin
  439.  
  440.     bsr setupgfx
  441.  
  442.     move.l himem,a0
  443.     btst.b #0,270(a0)
  444.     bne blacky
  445.     bsr setcols
  446.  
  447. blacky    rts
  448.  
  449. dohelp1    move.l #helptext1,a5
  450.     bsr page
  451.     bsr remove
  452.     rts
  453.  
  454. dohelp2    move.l #helptext2,a5
  455.     bsr page
  456.     bsr remove
  457.     rts
  458.  
  459. dohelp3    move.l #helptext3,a5
  460.     bsr page
  461.     bsr remove
  462.     rts
  463.  
  464. dohelp4 move.l #helptext4,a5
  465.     bsr page
  466.     bsr remove
  467.     rts
  468.  
  469. versions move.l #versionstext,a5
  470.     bsr page
  471.     bsr remove
  472.     rts
  473.  
  474. credits move.l #creditstext,a5
  475.     bsr page
  476.     bsr remove
  477.     rts
  478.  
  479. doabout move.l #abouttext,a5
  480.     bsr page
  481.     bsr remove
  482.     rts
  483.  
  484. bnw    bsr remove
  485.     move.l himem,a0
  486.     bset.b #0,270(a0)
  487.     move.l #cols2,a1
  488.     bsr setbnw
  489.     rts
  490.  
  491. colour    bsr remove
  492.     move.l himem,a0
  493.     bclr.b #0,270(a0)
  494.     bsr setcols
  495.     rts
  496.  
  497. doPAL    bsr remove
  498.     move.l himem,a0
  499.     bclr.b #1,270(a0)
  500.     bsr setmonitor
  501.     rts
  502.  
  503. doNTSC    bsr remove
  504.     move.l himem,a0
  505.     bset.b #1,270(a0)
  506.     bsr setmonitor
  507.     rts
  508.  
  509. mergethem bsr mergescores
  510.     rts
  511.  
  512. resetscores bsr newscores
  513.     bsr printhiscores
  514.     bsr savescores
  515.     rts 
  516.  
  517. quit    bsr remove
  518.     move.l stack,a7
  519.     bra quitgame
  520. newgame    move.l window,a0
  521.     move.w #1,d0
  522.     CALLINT OffMenu        * "New game"    
  523.     move.l window,a0    
  524.     move.l window,a0
  525.     move.w #$02,d0
  526.     CALLINT OffMenu        * "PAL"
  527.     move.l window,a0
  528.     move.w #$22,d0
  529.     CALLINT OffMenu        * "NTSC"
  530.     move.l window,a0
  531.     move.w #$f882,d0
  532.     CALLINT OffMenu        * "Face Graphics"
  533.     move.l window,a0
  534.     move.w #$f8a2,d0
  535.     CALLINT OffMenu        * "Back Graphics"
  536.     move.l window,a0
  537.     move.w #$f8c2,d0
  538.     CALLINT OffMenu        * "Symbols Graphics"
  539.     move.l window,a0
  540.     move.w #$e2,d0
  541.     CALLINT OffMenu        * "Merge Hi-Scores"
  542.     move.l window,a0
  543.     move.w #$f902,d0
  544.     CALLINT OffMenu        * "Reset Scores"
  545.     move.l window,a0
  546.     move.w #33,d0
  547.     CALLINT OnMenu        * "End game"
  548.     bsr remove
  549.     move.l window,a0
  550.     CALLINT ClearMenuStrip
  551.     add.w #4,a7
  552.     bra start
  553. endgame    move.l window,a0
  554.     move.w #33,d0
  555.     CALLINT OffMenu        * "End game"
  556.     bsr remove
  557.     add.w #4,a7
  558.     bra enditnow
  559.  
  560. remove    move.l userport,a0
  561.     CALLEXEC GetMsg    
  562.     tst.l d0
  563.     bne yes
  564.     rts
  565. yes    move.l d0,a1
  566.     CALLEXEC ReplyMsg
  567.     bra remove
  568.  
  569. ********* E V E R Y   N E W   G A M E *********
  570.  
  571. start    
  572.  
  573. again    bsr cls        * clear screen
  574.  
  575.     clr.w score
  576.     move.w #-3,firstpass    * Decrease score after 3 passes
  577.     bsr printscore
  578.  
  579.     bsr setup    * set up the screen & card table    
  580.  
  581.     move.l #seconds,a0
  582.     move.l #micros,a1
  583.     CALLINT CurrentTime
  584.     move.l seconds,oldsecs
  585.     move.l seconds,firsttime
  586.  
  587. bloop    move.l window,a0
  588.     move.l #klondike,a1
  589.     CALLINT SetMenuStrip
  590.  
  591.     bsr clear    * clear select bits
  592.  
  593.     bsr select    * set select bits on cards that can be moved
  594. yak    bsr testmenus
  595.     move.l #seconds,a0
  596.     move.l #micros,a1
  597.     CALLINT CurrentTime
  598.     move.l seconds,d0
  599.     sub.l oldsecs,d0
  600.     bcc notnegs
  601.     neg.l d0
  602. notnegs move.w score,d2
  603.     sub.w d0,d2
  604.     cmp.w #-30000,d2
  605.     ble nosub2
  606.     move.w d2,score
  607. nosub2    move.l seconds,oldsecs
  608. nottime    move.w score,d0
  609.     cmp.w oldscore,d0
  610.     beq notchanged
  611.     bsr printscore
  612. notchanged bsr checkselect    * see if mouse is over a select card    
  613.  
  614.  
  615. mouse    andi.b #$40,$bfe001
  616.     bne yak
  617.     
  618.     bsr checkselect
  619.     cmp.l #0,a4
  620.     beq yak
  621.  
  622.     move.l window,a0
  623.     CALLINT ClearMenuStrip    
  624.  
  625.     cmp.b #8,4(a4)
  626.     beq decker
  627.     btst.b #0,7(a4)
  628.     beq notfaced
  629.     cmp.b #7,4(a4)
  630.     bls intabby
  631.     bra notfaced
  632.     
  633.     
  634. ** Clicked on deck - Turn over next 3 cards **
  635.  
  636. ** Find number of face up deck cards **
  637.  
  638. decker    move.l tablememory,a0
  639.     clr.w d6
  640.     move.w #63,d1
  641. loopy    cmp.b #9,4(a0)
  642.     bne notdeckup
  643.     cmp.b 5(a0),d6
  644.     bhi notdeckup
  645.     move.b 5(a0),d6
  646. notdeckup add.w #10,a0
  647.     dbf d1,loopy
  648.  
  649.     tst.b 5(a4)
  650.     bne notturnup
  651.     move.l tablememory,a0
  652.     move.w #63,d0
  653.     sub.l a1,a1
  654. swapcard cmp.b #9,4(a0)
  655.     bne notdecku
  656.     move.b 5(a0),d1
  657.     neg.b d1
  658.     add.b d6,d1
  659.     add.b #1,d1
  660.     move.b d1,5(a0)
  661.     move.w #deck1x,(a0)
  662.     move.b #8,4(a0)
  663.     move.w #1,6(a0)  
  664.     move.l a0,a1
  665.  
  666. notdecku add.w #10,a0
  667.     dbf d0,swapcard
  668.  
  669.     cmp.l #0,a1
  670.     beq thatsallfolks
  671.     bsr fromtable
  672.     bsr drawcard
  673.  
  674.     add.w #1,firstpass
  675.     bmi firstone
  676.     cmp.w #-30000,score
  677.     ble firstone
  678.     sub.w #125,score        * Gone thru deck more than 3 times
  679.  
  680. ** Clear the three face up deck cards from screen **
  681.  
  682. firstone move.w #deck2x,d0
  683.     move.w foundy,d1
  684.     bsr setupdraw
  685.     and.w #$f000,d0
  686.     add.w #$b0a,d0
  687.     move.w d0,$040(a5)
  688.     move.w #2,d0
  689.     bsr drawplanes
  690.     move.w #deck2x+gap2*2,d0
  691.     move.w foundy,d1
  692.     bsr setupdraw
  693.     and.w #$f000,d0
  694.     add.w #$b0a,d0
  695.     move.w d0,$040(a5)
  696.     move.w #2,d0
  697.     bsr drawplanes
  698.     bra thatsallfolks
  699.  
  700. notturnup bsr sound3
  701.     move.w #deck2x+2*gap2,d7
  702.     move.l a4,a1
  703.     move.b 5(a4),d5
  704.  
  705.     move.w #2,d4
  706. threecards move.w d7,(a1)
  707.     move.w foundy,2(a1)
  708.     move.b #9,4(a1)
  709.     add.b #1,d6
  710.     move.b d6,5(a1)
  711.     clr.w 6(a1)
  712.  
  713.     bsr fromtable
  714.     bsr flyback
  715.     bsr flyback
  716.     bsr drawcard
  717.     
  718.     subq #1,d5
  719.  
  720. ** Find next card in deck **
  721.  
  722.     move.l tablememory,a1
  723.     clr.w d0
  724. loopy2    cmp.b #8,4(a1)
  725.     bne notdeckdown
  726.     cmp.b 5(a1),d5
  727.     beq gotgot
  728. notdeckdown add.w #10,a1
  729.     bra loopy2
  730.  
  731. gotgot    sub.w #gap2,d7
  732.     tst.b d5
  733.     beq endofpile
  734.     dbf d4,threecards
  735.  
  736. thatsallfolks andi.b #$40,$bfe001
  737.     beq thatsallfolks
  738.     bra bloop
  739.  
  740. endofpile bsr flyback 
  741.     bsr fromtable
  742.     bsr drawcard
  743.     bsr sound1
  744.     bra thatsallfolks
  745.  
  746. ** The card clicked on is face down and in the tableau - turn it up **
  747.  
  748. intabby    bsr sound1
  749.     bclr.b #0,7(a4)
  750.     move.l a4,a1
  751.     bsr fromtable
  752.     bsr drawcard
  753. mouseoff andi.b #$40,$bfe001
  754.     beq mouseoff
  755.     
  756.     add.w #25,score        * face down card turned over
  757.  
  758.     bra bloop
  759.  
  760.  
  761. notfaced bsr grabscreen
  762.     bsr pointer2
  763.     bsr gotcard
  764.     bsr select2
  765.     clr.l hilitecard    
  766.  
  767. mover    bsr newpos
  768.  
  769.     move.l himem,a4
  770.     btst.b #1,270(a4)
  771.     beq flyPAL
  772.     move.w #70,d6
  773.     move.w #200,d7
  774.     bra fly
  775. flyPAL    move.w #90,d6
  776.     move.w #235,d7
  777. fly    cmp.w newy,d6
  778.     bhi waitforbot
  779.  
  780. ** Wait for raster to reach bottom of ViewPort
  781.  
  782.     move.l viewport,a0
  783.     CALLGRAF WaitBOVP
  784.  
  785.     bra gotflyback
  786. waitforbot btst.b #1,270(a4)
  787.     bne nochk
  788.      btst.b #0,$dff005
  789.     bne gotflyback
  790. nochk    cmp.b $dff006,d7
  791.     bhi waitforbot
  792. gotflyback bsr slaponcards
  793.     bsr background
  794.     bsr checkselect2
  795.  
  796. ** Hilite the card if necessary **
  797.  
  798.     cmp.l #0,a4
  799.     beq nohilite
  800.     cmp.l hilitecard,a4
  801.     beq alreadyhilited
  802.  
  803.     cmp.b #7,4(a4)
  804.     bhi notintabl
  805.     tst.b 5(a4)
  806.     beq donthi
  807.  
  808. notintabl move.w (a4),d0
  809.     move.w 2(a4),d1
  810.     move.l cardmask,a0
  811.     bsr setupdraw
  812.     clr.w d0
  813.     move.l #bitmap2+16,a1    
  814.     bsr drawplanes
  815.     cmp.b #9,4(a4)
  816.     bls notgrey
  817.     tst.b 5(a4)
  818.     bne notgrey
  819.     move.w (a4),d0
  820.     move.w 2(a4),d1
  821.     move.l cardmask,a0
  822.     bsr setupdraw
  823.     clr.w d0
  824.     move.l #bitmap2+8,a1    
  825.     bsr drawplanes
  826.     move.l bitmap2+8,wherefrom
  827.     move.l bitmap,a0
  828.     move.l 8(a0),whereto
  829.     bsr replacehi
  830.  
  831. notgrey    move.l bitmap2+16,wherefrom
  832.     move.l bitmap,a0
  833.     move.l 16(a0),whereto
  834.     bsr replacehi
  835.  
  836. donthi    move.l hilitecard,d0
  837.     move.l a4,hilitecard
  838.     tst.l d0
  839.     beq alreadyhilited
  840.     move.l d0,a4
  841. unhilite cmp.b #7,4(a4)
  842.     bhi knot
  843.     tst.b 5(a4)
  844.     beq alreadyhilited
  845.  
  846. knot    move.l a4,a1
  847.     bsr fromtable
  848.     add.w #8*46*2,a0
  849.     bsr setupdraw
  850.     clr.w d0
  851.     move.l #bitmap2+16,a1    
  852.     bsr drawplanes
  853.     cmp.b #9,4(a4)
  854.     bls notgrey2
  855.     tst.b 5(a4)
  856.     bne notgrey2
  857.     move.l a4,a1
  858.     bsr fromtable
  859.     bsr setupdraw
  860.     clr.w d0
  861.     move.l #bitmap2+8,a1    
  862.     bsr drawplanes
  863.     move.l bitmap2+8,wherefrom
  864.     move.l bitmap,a0
  865.     move.l 8(a0),whereto
  866.     bsr replacehi
  867.     
  868.  
  869. notgrey2 move.l bitmap2+16,wherefrom
  870.     move.l bitmap,a0
  871.     move.l 16(a0),whereto
  872.     bsr replacehi
  873.     bra alreadyhilited
  874.     
  875. nohilite tst.l hilitecard
  876.     beq alreadyhilited
  877.     move.l hilitecard,a4 
  878.     clr.l hilitecard
  879.     bra unhilite
  880.  
  881. alreadyhilited
  882.  
  883.     andi.b #$40,$bfe001
  884.     beq mover
  885.     
  886.     bsr pointer1
  887.  
  888.     tst.l hilitecard
  889.     bne shiftcol
  890.     move.l movecard,a0
  891.     move.w (a0),d0
  892.     move.w 2(a0),d1
  893.     bsr forcenewpos
  894.     bsr slaponcards
  895.     bsr background
  896.     bra bloop
  897.  
  898. shiftcol bsr sound1 
  899.     move.l hilitecard,a0
  900.     move.l movecard,a1
  901.     cmp.b #7,4(a0)
  902.     bhi nottotableau    
  903.     cmp.b #9,4(a1)
  904.     bhi fromfoundations
  905.     bne notfromdeck
  906.     add.w #45,score        * From deck to tableau
  907.     bra nosub
  908. fromfoundations cmp.w #-30000,score
  909.     ble notfromdeck
  910.     sub.w #75,score
  911. notfromdeck btst.b #4,7(a1)
  912.     bne minusten
  913.     btst.b #0,7(a0)
  914.     beq nosub
  915. minusten cmp.w #-30000,score
  916.     ble nosub
  917.     sub.w #25,score        * Single card from tableau to tableau
  918.     bra nosub
  919.  
  920. nottotableau cmp.b #9,4(a1)
  921.     bhi nosub 
  922.     add.w #60,score    * Add card to foundations
  923. nosub    move.w 2(a0),d7
  924.     
  925. ontotable move.b 5(a0),d6
  926.     tst.b d6
  927.     beq space
  928.     cmp.b #9,4(a0)
  929.     bhi space
  930.     move.l a0,a1
  931.     bsr fromtable
  932.     bsr drawcard2
  933.     move.l a1,a0
  934.     add.w gapB,d7
  935.     btst.b #0,7(a0)
  936.     bne space
  937. snotback move.l tablememory,a1
  938.     subq #1,d6
  939.     move.b 4(a0),d0
  940. find1less cmp.b 4(a1),d0
  941.     bne notcolly
  942.     cmp.b 5(a1),d6
  943.     beq got1less
  944. notcolly add.w #10,a1
  945.     bra find1less
  946. got1less tst.b 5(a1)
  947.     beq biggap 
  948.     btst.b #0,7(a1)
  949.     beq space
  950. biggap    add.w #10,d7  
  951.     sub.w gapB,d7
  952.  
  953. space    move.l movecard,a1
  954.     move.b 5(a0),d6
  955.     move.w (a0),d3
  956.     move.b 4(a0),d2
  957.     btst.b #0,7(a0)
  958.     bne downmore
  959.     tst.b d6
  960.     bne shiftacard
  961. downmore move.w d7,2(a1)
  962.     add.w #10,d7
  963.     bra yaka
  964. shiftacard move.w d7,2(a1)
  965.     add.w gapB,d7
  966. yaka    move.b 4(a1),d4
  967.     move.b 5(a1),d5
  968.     addq #1,d5 
  969.     move.w d3,(a1)
  970.     move.b d2,4(a1)
  971.     addq #1,d6
  972.     move.b d6,5(a1)
  973.     clr.w 6(a1)
  974.     bsr fromtable
  975.     bsr drawcard2    
  976.  
  977.     move.l tablememory,a1
  978.     move.w #63,d0
  979. find1more cmp.b 4(a1),d4
  980.     bne notsamey
  981.     cmp.b 5(a1),d5
  982.     beq shiftacard
  983. notsamey add.w #10,a1
  984.     dbf d0,find1more
  985.  
  986.     bsr pushscreen
  987.  
  988.     move.l tablememory,a0
  989.     move.w #63,d0
  990.     clr.w d1
  991. allthere cmp.b #9,4(a0)
  992.     bls nojoy
  993.     addq #1,d1
  994. nojoy    add.w #10,a0
  995.     dbf d0,allthere
  996.     cmp.b #56,d1
  997.     bne bloop
  998.  
  999.  
  1000. *** GAME COMPLETED ***
  1001.  
  1002.     move.l #seconds,a0
  1003.     move.l #micros,a1
  1004.     CALLINT CurrentTime
  1005.     move.l seconds,d6
  1006.     sub.l firsttime,d6
  1007.     bcc notnegs2
  1008.     neg.l d6
  1009. notnegs2 move.w score,d7
  1010.     bmi nobonus
  1011.     move.w d6,d0
  1012.     mulu.w #5,d0
  1013.     sub.w d0,d7
  1014.     bcs nobonus
  1015.     mulu.w #2,d7
  1016.     add.w d7,score
  1017.     bsr printscore
  1018.     bra boney
  1019. nobonus    clr.w d7
  1020. boney    move.w d6,d0
  1021.     move.l #time,a1
  1022.     bsr donumber2
  1023.     move.b #32,(a1)+
  1024.     move.b #115,(a1)+    * s
  1025.     move.b #101,(a1)+    * e
  1026.     move.b #99,(a1)+    * c
  1027.     move.b #115,(a1)+    * s
  1028.     clr.b (a1)
  1029.     move.l #welldone2,a0
  1030.     CALLINT IntuiTextLength
  1031.     move.w #fleft+127,d5
  1032.     sub.w d0,d5
  1033.     lsr.w #1,d5
  1034.     move.w d5,welldone2+4
  1035.     move.w d7,d0
  1036.     move.l #bonus,a1
  1037.     bsr donumber2
  1038.     clr.b (a1)
  1039.     move.l #welldone3,a0
  1040.     CALLINT IntuiTextLength
  1041.     move.w #fleft+127,d5
  1042.     sub.w d0,d5
  1043.     lsr.w #1,d5
  1044.     move.w d5,welldone3+4
  1045.  
  1046.     move.l #welldonereq,a0
  1047.     move.l window,a1
  1048.     CALLINT Request
  1049.     bsr cheers
  1050.  
  1051. mouseB    andi.b #$40,$bfe001
  1052.     bne mouseB
  1053.  
  1054.     move.l #welldonereq,a0
  1055.     move.l window,a1
  1056.     CALLINT EndRequest
  1057.  
  1058.     move.w #ITEMTEXT+HIGHCOMP,game2+12    * "End game" menu off
  1059.  
  1060.     move.l window,a0
  1061.     move.l #klondike,a1
  1062.     CALLINT SetMenuStrip
  1063.  
  1064. enditnow
  1065.     add.w #1,games
  1066.     move.l #lastscr2,a1
  1067.     move.w score,d0
  1068.     bsr donumber2
  1069.     clr.b (a1) 
  1070.     move.l himem,a0
  1071.     add.w #256,a0
  1072.     move.w #14,d7
  1073. onhigh    move.w score,d1
  1074.     cmp.w 12(a0),d1
  1075.     ble nowayhozay
  1076.     cmp.b #14,d7
  1077.     beq upaplace
  1078.     move.w #6,d1
  1079. downscore move.w (a0)+,16(a0)
  1080.     dbf d1,downscore
  1081.     sub.w #14,a0
  1082. upaplace sub.w #18,a0
  1083.     dbf d7,onhigh
  1084.  
  1085. nowayhozay cmp.b #14,d7
  1086.     beq noton
  1087.     add.w #18,a0
  1088.  
  1089.     move.b #$20,(a0)+
  1090.     clr.b (a0)
  1091.     move.w score,11(a0)
  1092.     move.l a0,stringinfo
  1093.     clr.w stringinfo+8
  1094.     clr.w stringinfo+$0c
  1095.     clr.w stringinfo+$10
  1096.  
  1097.     clr.w ongadge
  1098.     move.l #highreq,a0
  1099.     move.l window,a1
  1100.     CALLINT Request
  1101.  
  1102.     move.l #textgadget,a0
  1103.     move.l window,a1
  1104.     move.l #highreq,a2
  1105.     CALLINT OnGadget
  1106.  
  1107.     moveq #5,d1
  1108.     CALLDOS Delay
  1109.  
  1110.     move.l #textgadget,a0
  1111.     move.l window,a1
  1112.     move.l #highreq,a2
  1113.     CALLINT ActivateGadget
  1114.  
  1115. waitgadge move.l userport,a0
  1116.     clr.l d1
  1117.     move.b $0f(a0),d1
  1118.     moveq #1,d0
  1119.     asl.l d1,d0
  1120.     CALLEXEC Wait
  1121.     move.l userport,a0
  1122.     CALLEXEC GetMsg
  1123.     tst.l d0
  1124.     beq waitgadge
  1125.     move.l d0,a1
  1126.     move.l $14(a1),d4
  1127.     CALLEXEC ReplyMsg
  1128.     cmp.w #$0100,d4    * MENUPICK
  1129.     beq waitgadge    
  1130.  
  1131.     move.l #games-142,a0    * test number of games played
  1132.     move.w multiples,d0
  1133.     add.w #55536+30,d0
  1134.     cmp.w 142(a0),d0
  1135.     bra savem    * Remove this line for V1.1b & c
  1136.     bhi savem
  1137.     move.l himem,a0
  1138.     add.b #2,d7
  1139.     move.b d7,271(a0)    * display message
  1140.     bra savem2
  1141.  
  1142. savem    move.l stringinfo,a0
  1143.     move.b #254,-1(a0)    * Colour name
  1144.     bsr printhiscores
  1145.     move.l stringinfo,a0
  1146.     move.b #254,-1(a0)
  1147. savem2    bsr savescores
  1148.     move.l himem,a0
  1149.     move.w 270(a0),oldstatus
  1150.     bra missnoton    
  1151.  
  1152. noton    move.l himem,a0
  1153.     move.w oldstatus,d0
  1154.     cmp.w 270(a0),d0
  1155.     beq missnoton
  1156.     bra savem
  1157. missnoton cmp.w #5,games
  1158.     bne beginning
  1159.     bsr doabout    
  1160.     bra beginning
  1161.  
  1162. quitgame bsr savescores
  1163.  
  1164. freesoundmem move.l soundmem,a1
  1165.     move.l #soundsize,d0
  1166.     CALLEXEC FreeMem
  1167.  
  1168. freerastport move.l rastport2,a1
  1169.     move.l #100,d0
  1170.     CALLEXEC FreeMem
  1171.  
  1172. freehimem move.l himem,a1 
  1173.     move.l #hiscrsize,d0
  1174.     CALLEXEC FreeMem
  1175.     
  1176. freerastermem move.l #bitmap2+8,a5
  1177.     move.w #2,d7
  1178. rastfree move.l (a5)+,a1
  1179.     cmp.l #0,a1
  1180.     beq freemovemem
  1181.     move.l #80*maxscrheight,d0
  1182.     CALLEXEC FreeMem
  1183.     dbf d7,rastfree
  1184.  
  1185. freemovemem move.l movememory,a1
  1186.     move.l #maxplane*4,d0
  1187.     CALLEXEC FreeMem
  1188.  
  1189. freetablemem move.l tablememory,a1
  1190.     move.l #tablemem,d0
  1191.     CALLEXEC FreeMem
  1192.  
  1193. freecardmem move.l cardmemory,a1
  1194.     move.l #cardmem,d0
  1195.     CALLEXEC FreeMem
  1196.  
  1197. closewindow move.l window,a0
  1198.     CALLINT ClearMenuStrip
  1199.     move.l window,a0
  1200.     CALLINT CloseWindow
  1201.  
  1202. freesubmenus move.l #firstsub1,a5
  1203.     bsr freesubs
  1204.     move.l #firstsub2,a5
  1205.     bsr freesubs
  1206.     move.l #firstsub3,a5
  1207.     bsr freesubs
  1208.  
  1209. closescreen move.l screen,a0
  1210.     CALLINT CloseScreen
  1211.  
  1212. freesignal clr.l d0
  1213.     move.b signal,d0
  1214.     CALLEXEC FreeSignal
  1215.  
  1216. closeaudio move.l #iorequest,a1
  1217.     CALLEXEC CloseDevice
  1218.  
  1219. closeint move.l _IntuitionBase,a1
  1220.     CALLEXEC CloseLibrary
  1221.  
  1222.  
  1223. closegraf move.l _GfxBase,a1
  1224.     CALLEXEC CloseLibrary
  1225.  
  1226. closedos move.l _DOSBase,a1
  1227.     CALLEXEC CloseLibrary
  1228.  
  1229. end    tst.l _WBenchMsg
  1230.     beq notwb
  1231.     CALLEXEC Forbid
  1232.     move.l _WBenchMsg,a1
  1233.     CALLEXEC ReplyMsg
  1234. notwb    rts
  1235.  
  1236.  
  1237. mousey    andi.b #$40,$bfe001
  1238.     bne mousey
  1239.     clr.l d0
  1240. wait    dbf d0,wait
  1241. mousey2    andi.b #$40,$bfe001
  1242.     beq mousey2
  1243.     rts
  1244.  
  1245.  
  1246.     *****************************
  1247.     ** S U B - R O U T I N E S **
  1248.     *****************************
  1249.  
  1250. ** Load in the graphics files **
  1251.  
  1252. setupgfx move.l rastport2,d7 
  1253.     move.w #maxscrheight-10,d6
  1254.     bsr cls2
  1255.     
  1256.     move.l #backdir,d1
  1257.     move.w #311,d0
  1258.     move.l #firstsub2,a4
  1259.     bsr loadgfx
  1260.  
  1261.     tst.l d0
  1262.     beq cockup
  1263.  
  1264.     move.l #symbolsdir,d1
  1265.     move.w #344,d0
  1266.     move.l #firstsub3,a4
  1267.     bsr loadgfx
  1268.  
  1269.     tst.l d0
  1270.     beq cockup
  1271.  
  1272.     move.l #facedir,d1
  1273.     move.w #278,d0
  1274.     move.l #firstsub1,a4
  1275.     bsr loadgfx
  1276.  
  1277.     tst.l d0
  1278.     beq cockup
  1279.  
  1280.     bsr createcards
  1281.  
  1282.     move.b #-1,d0
  1283.  
  1284. cockup    rts
  1285.  
  1286. loadgfx    move.l himem,a5
  1287.     add.w d0,a5
  1288.     move.l a4,d7
  1289.  
  1290.     move.l #ACCESS_READ,d2
  1291.     CALLDOS Lock
  1292.     tst.l d0
  1293.     beq blunder
  1294.     move.l d0,lock1
  1295.  
  1296.     move.l d0,d1
  1297.     CALLDOS CurrentDir
  1298.     move.l d0,lock2
  1299.  
  1300. seethenext tst.l (a4)
  1301.     beq notonlist
  1302.     move.l (a4),a4
  1303.  
  1304.     move.l 18(a4),a3
  1305.     move.l 12(a3),a3
  1306.     add.w #2,a3
  1307.  
  1308.     move.l a5,a2
  1309. comparethem move.b (a3)+,d0
  1310.     beq thisistheone
  1311.     cmp.b (a2)+,d0
  1312.     beq comparethem
  1313.     bra seethenext
  1314.  
  1315. thisistheone or.w #CHECKED,12(a4)
  1316.     bra trytoload    
  1317.     
  1318. notonlist move.l d7,a4
  1319.     move.l (a4),a4
  1320.     or.w #CHECKED,12(a4)
  1321.     move.l 18(a4),a4
  1322.     move.l 12(a4),a4
  1323.     add.w #2,a4
  1324.  
  1325.     move.l a5,a3
  1326. movetext move.b (a4)+,(a3)+
  1327.     bne movetext
  1328.  
  1329. trytoload bsr loadILBM
  1330.     tst.l d0
  1331.     beq blooper
  1332.  
  1333.     move.l lock2,d1
  1334.     CALLDOS CurrentDir
  1335.     move.l lock1,d1
  1336.     CALLDOS UnLock
  1337.  
  1338.     move.b #-1,d0
  1339.  
  1340.     rts
  1341.  
  1342. blooper move.l lock2,d1
  1343.     CALLDOS CurrentDir
  1344.     move.l lock1,d1
  1345.     CALLDOS UnLock
  1346.  
  1347. blunder    clr.l d0
  1348.     rts
  1349.  
  1350.  
  1351. ** Search through graphics drawers for graphics files **
  1352. ** and add them to the menu lists **
  1353.  
  1354. graphicsmenus move.l #fib_SIZEOF,d0
  1355.     move.l #$10001,d1
  1356.     CALLEXEC AllocMem
  1357.     tst.l d0
  1358.     bne gotcha
  1359.     rts
  1360.  
  1361. gotcha move.l d0,buffer
  1362.  
  1363. ** First set up the card backs sub menus **
  1364.  
  1365.     move.l #facedir,d1
  1366.     bsr fillfib
  1367.     tst.l d0
  1368.     beq goawayfib
  1369.  
  1370.     move.l #firstsub1,a5
  1371.     bsr setupsubs
  1372.     tst.l d0
  1373.     beq goawayfib
  1374.  
  1375. ** Now set up the card backs sub menus **
  1376.  
  1377.     move.l lock2,d1
  1378.     CALLDOS CurrentDir
  1379.  
  1380.     move.l lock1,d1
  1381.     CALLDOS UnLock
  1382.  
  1383.     move.l #backdir,d1
  1384.     bsr fillfib
  1385.     tst.l d0
  1386.     beq goawayfib
  1387.  
  1388.     move.l #firstsub2,a5
  1389.     bsr setupsubs
  1390.     tst.l d0
  1391.     beq goawayfib
  1392.  
  1393. ** Now set up the card symbols sub menus **
  1394.  
  1395.     move.l lock2,d1
  1396.     CALLDOS CurrentDir
  1397.  
  1398.     move.l lock1,d1
  1399.     CALLDOS UnLock
  1400.  
  1401.     move.l #symbolsdir,d1
  1402.     bsr fillfib
  1403.     tst.l d0
  1404.     beq goawayfib
  1405.  
  1406.     move.l #firstsub3,a5
  1407.     bsr setupsubs
  1408.     tst.l d0
  1409.     beq goawayfib
  1410.  
  1411.     move.l lock2,d1
  1412.     CALLDOS CurrentDir
  1413.  
  1414.     move.l lock1,d1
  1415.     CALLDOS UnLock
  1416.  
  1417.     move.b #-1,d0
  1418.  
  1419. goawayfib move.l d0,d7
  1420.     move.l #fib_SIZEOF,d0
  1421.     move.l buffer,a1
  1422.     CALLEXEC FreeMem
  1423.     rts
  1424.  
  1425.  
  1426. ** Search for ILBM files & set up submenus **
  1427.  
  1428. setupsubs move.w #5,d7
  1429.     move.l #$fffffffe,d5
  1430. lookforanother move.w d7,-(sp)
  1431.     bsr findilbmfile
  1432.     move.w (sp)+,d7
  1433.     tst.l d0
  1434.     beq endofdir
  1435.     move.l d0,a4    
  1436.  
  1437.     bsr allocsubmenu
  1438.     tst.l d0
  1439.     beq mess2
  1440.     move.l d0,(a5)
  1441.     move.l d0,a5
  1442.  
  1443.     move.l a5,-(sp)
  1444.     clr.l (a5)+
  1445.     move.w #148,(a5)+
  1446.     move.w d7,(a5)+
  1447.     add.w #9,d7
  1448.     move.l #((maxname+3)*8+4)*65536+9,(a5)+
  1449.     move.w #ITEMTEXT+ITEMENABLED+HIGHCOMP+CHECKIT,(a5)+
  1450.     move.l d5,(a5)
  1451.     rol.l #1,d5
  1452.     add.w #20,a5
  1453.     move.l a5,-16(a5)
  1454.  
  1455.     move.l #$07000000,(a5)+
  1456.     move.l #$00050000,(a5)+
  1457.     add.w #12,a5
  1458.     move.l a5,-8(a5)
  1459.  
  1460.     move.w #$2020,(a5)+
  1461.     move.w #15,d0
  1462. fillinname move.b (a4)+,(a5)+
  1463.     dbf d0,fillinname
  1464.     
  1465.     move.l (sp)+,a5
  1466.     bra lookforanother
  1467.  
  1468. endofdir move.b #-1,d0    
  1469. mess2 rts
  1470.  
  1471.  
  1472. ** Fill in fileinfoblock **
  1473.  
  1474. fillfib    move.l #ACCESS_READ,d2
  1475.     CALLDOS Lock
  1476.     tst.l d0
  1477.     beq mess
  1478.  
  1479.     move.l d0,lock1
  1480.     move.l d0,d1
  1481.     CALLDOS CurrentDir
  1482.     move.l d0,lock2
  1483.  
  1484.     move.l lock1,d1
  1485.     move.l buffer,d2
  1486.     CALLDOS Examine
  1487.  
  1488. mess rts
  1489.  
  1490. ** Search for next ilbm file given a lock **
  1491.  
  1492. findilbmfile move.l lock1,d1
  1493.     move.l buffer,d2
  1494.     CALLDOS ExNext
  1495.     tst.l d0
  1496.     beq ioerror
  1497.     
  1498.     move.l buffer,a0
  1499.     tst.l fib_EntryType(a0)
  1500.     bpl findilbmfile    * Directory
  1501.     
  1502.     move.l a0,d1
  1503.     add.l #fib_FileName,d1
  1504.     move.l d1,d6
  1505.     move.l #1005,d2
  1506.     CALLDOS Open
  1507.     tst.l d0
  1508.     beq findilbmfile
  1509.     move.l d0,d7    
  1510.  
  1511.     move.l #loadbuffer,d2
  1512.     move.l #12,d3
  1513.     move.l d7,d1
  1514.     CALLDOS Read
  1515.  
  1516.     move.l d7,d1
  1517.     CALLDOS Close
  1518.  
  1519.     cmp.l #$494c424d,loadbuffer+8    * ILBM ?
  1520.     bne findilbmfile
  1521.  
  1522.     move.l d6,d0
  1523.  
  1524.     rts    
  1525.  
  1526. ioerror CALLDOS IoErr
  1527.     cmp.l #ERROR_NO_MORE_ENTRIES,d0
  1528.     bne findilbmfile
  1529.     clr.l d0
  1530.     rts
  1531.  
  1532. ** Allocate memory for a submenu **
  1533.  
  1534. allocsubmenu move.l #34+20+maxname+3,d0
  1535.     move.l #$10001,d1
  1536.     CALLEXEC AllocMem
  1537.     rts
  1538.  
  1539. ** Free memory for submenus **
  1540.  
  1541. freesubs tst.l (a5)
  1542.     beq endoflist
  1543.     move.l (a5),a5
  1544. freenextsub    move.l a5,a1
  1545.     move.l (a5),a5
  1546.     move.l #34+20+maxname+3,d0
  1547.     CALLEXEC FreeMem
  1548.     move.l a5,d0
  1549.     tst.l d0
  1550.     bne freenextsub
  1551.  
  1552. endoflist rts
  1553.  
  1554. ** Call this routine to set PAL or NTSC mode **
  1555.  
  1556. setmonitor move.l himem,a0
  1557.     btst.b #1,270(a0)
  1558.     beq displayPAL
  1559.     
  1560.    ** set up NTSC screen **
  1561.  
  1562.      ** card positions
  1563.  
  1564.     move.w #208,scrheight
  1565.     move.w #6,gapA
  1566.     move.w #4,gapB
  1567.     move.w #71,topy
  1568.     move.w #12,foundy
  1569.     move.w #61,scorepos
  1570.  
  1571.      ** high score table
  1572.  
  1573.     move.w #11,htop
  1574.     move.w #hhiteN,hhite
  1575.     move.l #boxN,boxloc
  1576.     move.w #7,y1
  1577.     move.w #6,y2
  1578.     move.w #166,y3
  1579.     move.w #165,y4
  1580.     move.w #176,y5
  1581.     move.w #175,y6
  1582.     move.w #28,name1pos    
  1583.     clr.w name2down
  1584.  
  1585.      ** text pages
  1586.  
  1587.     move.w #184,y7
  1588.     move.w #184,y8
  1589.     move.w #whiteN,white
  1590.     move.l #boxN2,boxloc2
  1591.  
  1592.     bra newdisplay
  1593.  
  1594. displayPAL move.w #258,scrheight
  1595.     move.w #7,gapA
  1596.     move.w #7,gapB
  1597.     move.w #80,topy
  1598.     move.w #17,foundy
  1599.     move.w #68,scorepos
  1600.     move.w #20,htop
  1601.     move.w #hhiteP,hhite
  1602.     move.l #boxP,boxloc
  1603.     move.w #12,y1
  1604.     move.w #11,y2
  1605.     move.w #190,y3
  1606.     move.w #189,y4
  1607.     move.w #201,y5
  1608.     move.w #200,y6
  1609.     move.w #39,name1pos    
  1610.     move.w #8,name2down
  1611.     move.w #226,y7
  1612.     move.w #226,y8
  1613.     move.w #whiteP,white
  1614.     move.l #boxP2,boxloc2
  1615.  
  1616. newdisplay bsr cls 
  1617.     bsr printhiscores
  1618.     rts
  1619.     
  1620.  
  1621. ** Merge another disk's Hi-Scores with those already in memory **
  1622.  
  1623. mwidth    equ 360
  1624. mhite    equ 140
  1625. mtop    equ 50
  1626. mleft    equ 320-mwidth/2
  1627.  
  1628. mergescores move.l window,a0
  1629.     CALLINT ClearMenuStrip
  1630.     bsr grabscreen
  1631.  
  1632.     move.l rastport,a5
  1633.     
  1634.     clr.w d0
  1635.     move.l a5,a1
  1636.     CALLGRAF SetDrMd    * Set JAM1
  1637.     move.l a5,a1
  1638.     move.w #1,d0
  1639.     CALLGRAF SetAPen
  1640.     move.l a5,a1
  1641.     clr.w d1
  1642.     CALLGRAF SetBPen
  1643.  
  1644.     move.l a5,a1
  1645.     move.w #mleft,d0
  1646.     move.w #mtop,d1
  1647.     move.w #mleft+mwidth-1,d2
  1648.     move.w #mtop+mhite-1,d3
  1649.     CALLGRAF RectFill
  1650.  
  1651.     move.l a5,a0
  1652.     move.l #mbox1,a1
  1653.     move.w #mleft,d0
  1654.     move.w #mtop,d1
  1655.     CALLINT DrawBorder
  1656.  
  1657.     move.l a5,a0
  1658.     move.l #mtext1,a1
  1659.     move.w #mleft,d0
  1660.     move.w #mtop,d1
  1661.     CALLINT PrintIText
  1662.  
  1663. ** double the height of "Merge Hi-Scores"
  1664.  
  1665.     move.l bitmap,a0
  1666.     move.w #80*10,d0
  1667.     move.w #(mtop+18)*80+26,d1
  1668.     move.l 8(a0),a1
  1669.     add.w d1,a1
  1670.     move.l a1,a4
  1671.     sub.w d0,a4
  1672.     move.l 12(a0),a2
  1673.     add.w d1,a2
  1674.     move.l a2,a5
  1675.     sub.w d0,a5
  1676.     move.l 16(a0),a3
  1677.     add.w d1,a3
  1678.     move.l a3,a6
  1679.     sub.w d0,a6
  1680.  
  1681.     move.w #9,d0
  1682. double3    move.w #26,d1
  1683. double4    move.b (a1),(a4)+
  1684.     move.b (a1)+,79(a4)
  1685.     move.b (a2),(a5)+
  1686.     move.b (a2)+,79(a5)
  1687.     move.b (a3),(a6)+
  1688.     move.b (a3)+,79(a6)
  1689.     dbf d1,double4
  1690.     add.w #53,a1
  1691.     add.w #53,a2
  1692.     add.w #53,a3
  1693.     add.w #53+80,a4
  1694.     add.w #53+80,a5
  1695.     add.w #53+80,a6
  1696.  
  1697.     dbf d0,double3
  1698.  
  1699.     move.l #mtextJ,gadtext
  1700.     move.l #mtextI,gadtext2
  1701.     move.w #1002,mtype
  1702.     move.w #1003,mtype2    
  1703.     bsr gadgetson
  1704.  
  1705. waitgadgey2 move.l userport,a0
  1706.     clr.l d1
  1707.     move.b $0f(a0),d1
  1708.     moveq #1,d0
  1709.     asl.l d1,d0
  1710.     CALLEXEC Wait
  1711.     move.l userport,a0
  1712.     CALLEXEC GetMsg
  1713.     tst.l d0
  1714.     beq waitgadgey2
  1715.     move.l d0,a1
  1716.     move.l $14(a1),d4
  1717.     move.l $1c(a1),a4
  1718.     CALLEXEC ReplyMsg
  1719.     cmp.w #$0100,d4    * MENUPICK
  1720.     beq waitgadgey2    
  1721.  
  1722.     cmp.w #1003,38(a4)    * PANIC - Display help page
  1723.     beq panic
  1724.     bsr gadgetsoff    
  1725.     move.l #mtextM,gadtext2
  1726.  
  1727.     move.l rastport,a0
  1728.     move.l #mtext3,a1
  1729.     move.w #mleft,d0
  1730.     move.w #mtop,d1
  1731.     CALLINT PrintIText
  1732.  
  1733.     move.l rastport,a0
  1734.     move.l #mbox3,a1
  1735.     move.w #mleft,d0
  1736.     move.w #mtop,d1
  1737.     CALLINT DrawBorder
  1738.  
  1739.     move.l window,a0
  1740.     move.l #mgadg,a1
  1741.     move.w #-1,d0
  1742.     CALLINT AddGadget
  1743.  
  1744.     move.l #mgadg,a0
  1745.     move.l window,a1
  1746.     sub.l a2,a2
  1747.     CALLINT OnGadget
  1748.  
  1749.  
  1750. msearch    move.l #mtextD,a0
  1751.     bsr filemess        * searching.....
  1752.  
  1753. ** try to Lock selected directory
  1754.  
  1755.     move.l #mergename,d1
  1756.     move.w #-1,d2
  1757.     CALLDOS Lock
  1758.     tst.l d0
  1759.     bne founddir
  1760.  
  1761.     move.l #mtextE,a0
  1762.     bsr filemess        * Can't find directory
  1763.     move.l #mtextO,gadtext
  1764.     move.w #1004,mtype
  1765.     bsr gadgetson
  1766.  
  1767.     bra input
  1768.     
  1769. founddir move.l d0,lock1    * remember Lock
  1770.     move.l d0,d1
  1771.     CALLDOS CurrentDir
  1772.     move.l d0,lock2
  1773.  
  1774. ** try to Lock Hi-Scores file
  1775.  
  1776.     move.l #filename2,d1
  1777.     move.w #-1,d2
  1778.     CALLDOS Lock
  1779.     tst.l d0
  1780.     bne foundHighs 
  1781.     move.l #mtextF,a0    * Can't find file
  1782.     bsr filemess
  1783.     move.l #mtextO,gadtext
  1784.     move.w #1004,mtype
  1785.     bsr gadgetson
  1786.     move.l lock1,d1
  1787.     CALLDOS UnLock        * Unlock directory
  1788.     move.l lock2,d1
  1789.     CALLDOS CurrentDir    * replace current directory
  1790.     bra input    
  1791.  
  1792. foundHighs move.l d0,d1
  1793.     CALLDOS UnLock
  1794.     move.l #mtextG,a0
  1795.     bsr filemess        * Found file
  1796.     move.l #mtextK,gadtext
  1797.     move.w #1002,mtype
  1798.  
  1799. ** Load in the hi-scores
  1800.  
  1801.     move.l #bitmap2,a5
  1802.     move.l 8(a5),a5
  1803.     move.l a5,d4        * use bitplane 0 as a buffer
  1804.     move.l #filename2,d1
  1805.     move.l #300,d3
  1806.     bsr load
  1807.     bne readerror
  1808.  
  1809.     move.l a5,a0
  1810.     bsr unscramble2
  1811.     move.l a5,a0
  1812.     bsr checksum2
  1813.     cmp.l 272(a5),d1
  1814.     bne readerror
  1815.         
  1816.     bra displaygadg
  1817.  
  1818. readerror move.l #mtextN,a0
  1819.     bsr filemess
  1820.     move.l #mtextO,gadtext
  1821.     move.w #1004,mtype
  1822.  
  1823. displaygadg move.l lock1,d1
  1824.     CALLDOS UnLock        * Unlock directory
  1825.     move.l lock2,d1
  1826.     CALLDOS CurrentDir    * replace current directory
  1827.  
  1828.     bsr gadgetson
  1829.     bra waitgadgey
  1830.  
  1831. input    
  1832.     move.l #mgadg,a0
  1833.     move.l window,a1
  1834.     sub.l a2,a2
  1835.     CALLINT ActivateGadget
  1836.  
  1837. waitgadgey move.l userport,a0
  1838.     clr.l d1
  1839.     move.b $0f(a0),d1
  1840.     moveq #1,d0
  1841.     asl.l d1,d0
  1842.     CALLEXEC Wait
  1843.     move.l userport,a0
  1844.     CALLEXEC GetMsg
  1845.     tst.l d0
  1846.     beq waitgadgey
  1847.     move.l d0,a1
  1848.     move.l $14(a1),d4
  1849.     move.l $1c(a1),a4
  1850.     CALLEXEC ReplyMsg
  1851.     cmp.w #$0100,d4    * MENUPICK
  1852.     beq waitgadgey    
  1853.  
  1854.     move.w 38(a4),d7
  1855.  
  1856.     cmp.w #1001,d7        * text gadget4
  1857.     beq msearch
  1858.     cmp.w #1003,d7        * Cancel
  1859.     beq finit
  1860.     cmp.w #1004,d7        * Retry
  1861.     beq msearch
  1862.     cmp.w #1005,d7        * Done it
  1863.     beq cancel1
  1864.     cmp.w #1002,d7        * Merge
  1865.     bne waitgadgey
  1866.     
  1867. ** Cancel any identical entries
  1868.  
  1869.     move.l #bitmap2,a0
  1870.     move.l 8(a0),a0
  1871.     add.w #4,a0
  1872.     move.w #14,d2
  1873. mcancel1 move.l himem,a1
  1874.     add.w #4,a1
  1875.     move.w #14,d0
  1876. mcancel2 move.l a0,a2
  1877.     move.l a1,a3
  1878.     move.w #6,d1
  1879. mcheck1    move.w (a1)+,d3
  1880.     cmp.w (a0)+,d3
  1881.     bne mnotsame
  1882.     dbf d1,mcheck1
  1883.     clr.w -2(a0)    * Cancel score
  1884. mnotsame move.l a2,a0
  1885.     move.l a3,a1
  1886.     add.w #18,a1
  1887.     dbf d0,mcancel2
  1888.     add.w #18,a0
  1889.     dbf d2,mcancel1
  1890.  
  1891. ** Merge the high scores
  1892.  
  1893.     move.l #bitmap2,a5
  1894.     move.l 8(a5),a5
  1895.     add.w #256,a5 
  1896.     move.w #14,d6
  1897. all15    move.l himem,a0
  1898.     add.w #256,a0
  1899.     move.w #14,d7
  1900. monhigh    move.w 12(a5),d1
  1901.     cmp.w 12(a0),d1
  1902.     ble mnowayhozay
  1903.     cmp.b #14,d7
  1904.     beq mupaplace
  1905.     move.w #6,d1
  1906. mdownscore move.w (a0)+,16(a0)
  1907.     dbf d1,mdownscore
  1908.     sub.w #14,a0
  1909. mupaplace sub.w #18,a0
  1910.     dbf d7,monhigh
  1911.  
  1912. mnowayhozay cmp.b #14,d7
  1913.     beq mnoton
  1914.     add.w #18,a0
  1915.  
  1916.     move.w #6,d1
  1917. transfer move.w (a5)+,(a0)+
  1918.     dbf d1,transfer
  1919.     move.b #255,-14(a0)    * so can change colour
  1920.     sub.w #14,a5
  1921. mnoton    sub.w #18,a5
  1922.     dbf d6,all15
  1923.     move.w #1002,d7
  1924.  
  1925. finit    move.l window,a0
  1926.     move.l #mgadg,a1
  1927.     CALLINT RemoveGadget
  1928.  
  1929.     bsr gadgetsoff
  1930.  
  1931.     move.l rastport,a1
  1932.     move.w #mleft+6,d0
  1933.     move.w #mtop+40,d1
  1934.     move.w #mleft+mwidth-7,d2
  1935.     move.w #mtop+mhite-5,d3
  1936.     CALLGRAF RectFill
  1937.  
  1938.     cmp.w #1002,d7        * Merge
  1939.     bne notext1
  1940.     
  1941.     move.l rastport,a0
  1942.     move.l #mtext12,a1
  1943.     move.w #mleft,d0
  1944.     move.w #mtop,d1
  1945.     CALLINT PrintIText
  1946.  
  1947. notext1    move.l rastport,a0
  1948.     move.l #mtext11,a1
  1949.     move.w #mleft,d0
  1950.     move.w #mtop,d1
  1951.     CALLINT PrintIText
  1952.  
  1953.     move.l #mtextJ,gadtext
  1954.     move.l #mtextJ,gadtext2
  1955.     move.w #1005,mtype
  1956.     move.w #1005,mtype2
  1957.     bsr gadgetson
  1958.  
  1959.     bra waitgadgey
  1960.  
  1961. cancel1    bsr gadgetsoff
  1962.     
  1963.     bsr pushscreen
  1964. finitos    bsr printhiscores
  1965.     move.l window,a0
  1966.     move.l #klondike,a1
  1967.     CALLINT SetMenuStrip
  1968.  
  1969.     rts
  1970.  
  1971. panic    bsr gadgetsoff
  1972.     bsr pushscreen
  1973.     move.l window,a0
  1974.     move.l #klondike,a1
  1975.     CALLINT SetMenuStrip
  1976.     bsr dohelp4
  1977.     bra finitos
  1978.  
  1979. ** Add and display the two merge scores gadgets 
  1980.  
  1981. gadgetson move.l window,a0
  1982.     move.l #mgadg2,a1
  1983.     move.w #-1,d0
  1984.     CALLINT AddGadget
  1985.  
  1986.     move.l window,a0
  1987.     move.l #mgadg3,a1
  1988.     move.w #-1,d0
  1989.     CALLINT AddGadget
  1990.  
  1991.     move.l #mgadg2,a0
  1992.     move.l window,a1
  1993.     sub.l a2,a2
  1994.     CALLINT OnGadget
  1995.  
  1996.     move.l #mgadg3,a0
  1997.     move.l window,a1
  1998.     sub.l a2,a2
  1999.     CALLINT OnGadget
  2000.  
  2001.     rts
  2002.  
  2003. ** And remove them 
  2004.  
  2005. gadgetsoff move.l window,a0
  2006.     move.l #mgadg2,a1
  2007.     CALLINT RemoveGadget
  2008.     
  2009.     move.l window,a0
  2010.     move.l #mgadg3,a1
  2011.     CALLINT RemoveGadget
  2012.  
  2013.     rts
  2014.  
  2015. ** Print file message in the merge hi-scores requester **
  2016.  
  2017. filemess move.w #mleft,d0
  2018.     move.w #mtop,d1
  2019.     move.l a0,messg
  2020.     move.l rastport,a0
  2021.     move.l #mtext7,a1
  2022.     CALLINT PrintIText
  2023.  
  2024.     move.l screen,a0
  2025.     CALLINT ScreenToFront
  2026.  
  2027.     rts
  2028.  
  2029.  
  2030. *****  Set pointer colours *****
  2031.  
  2032. pointcols move.l #pointpens,a4
  2033.     move.w #17,d7
  2034. nextpen    move.w d7,d0
  2035.     move.b (a4)+,d1
  2036.     move.b (a4)+,d2
  2037.     move.b (a4)+,d3
  2038.     move.l viewport,a0
  2039.     CALLGRAF SetRGB4
  2040.     add.w #1,d7
  2041.     cmp.b #19,d7
  2042.     bls nextpen
  2043.     rts
  2044.  
  2045. *****  Set pointy finger pointer *****
  2046.  
  2047. pointer1 move.l soundmem,a1
  2048.     bra dopointer
  2049.  
  2050. *****  Set flat hand pointer *****
  2051.  
  2052. pointer2 move.l soundmem,a1
  2053.     add.w #64,a1
  2054.  
  2055. dopointer move.l window,a0
  2056.     move.w #14,d0
  2057.     move.w #16,d1
  2058.     move.w #-1,d2
  2059.     move.w #-1,d3
  2060.     CALLINT SetPointer
  2061.     rts
  2062.  
  2063.  
  2064. *****  Play the sound  *****
  2065.  
  2066. sound1    move.l #snd3,d0 * sound of 1 card turnover
  2067.     move.l #snd0+snd1+snd2,d1
  2068.     move.w #20,d2
  2069.     bra play
  2070.     
  2071. sound3    move.l #snd4,d0    * sound of 3 cards turnover
  2072.     move.l #snd0+snd1+snd2+snd3,d1
  2073.     move.w #20,d2
  2074.     bra play
  2075.  
  2076. cheers    move.l #snd5,d0
  2077.     move.l #snd0+snd1+snd2+snd3+snd4,d1
  2078.     move.w #64,d2
  2079.     move.w #550,iorequest+$2a
  2080.     bra play2
  2081.  
  2082. play    move.w #450,iorequest+$2a
  2083. play2    move.w d2,iorequest+$2c
  2084.     move.l #iorequest,a1
  2085.     move.l soundmem,a0
  2086.     add.l d1,a0
  2087.     move.w #8,$1c(a1)    * CMD_FLUSH
  2088.     move.l a0,$22(a1)
  2089.     move.l d0,$26(a1)
  2090.     move.w #1,$2e(a1)
  2091.  
  2092.     CALLEXEC SendIO    
  2093.  
  2094.     move.l #iorequest,a1
  2095.     move.b #$10,$1e(a1)
  2096.     move.w #3,$1c(a1)
  2097.  
  2098.     move.l $14(a1),a6
  2099.     jsr -$1e(a6)    * BEGINIO
  2100.  
  2101.     rts
  2102.  
  2103. ***** Draw a window and display pages of text starting in a5 *****
  2104.  
  2105. whiteN    equ 189
  2106. whiteP    equ 229
  2107. wtop    equ 10
  2108. wwidth    equ 640
  2109. wleft    equ (640-wwidth)/2    
  2110.  
  2111. page    move.l window,a0
  2112.     move.w #$7e1,d0
  2113.     CALLINT OffMenu        * Options menu
  2114.     move.l window,a0
  2115.     move.w #$7e2,d0
  2116.     CALLINT OffMenu        * game menu
  2117.     move.l window,a0
  2118.     move.w #$7e3,d0
  2119.     CALLINT OffMenu        * Help menu
  2120.     move.l window,a0
  2121.     move.w #0,d0
  2122.     CALLINT OffMenu
  2123.     move.l window,a0
  2124.     move.w #$20,d0
  2125.     CALLINT OffMenu
  2126.     move.l window,a0
  2127.     move.w #$40,d0
  2128.     CALLINT OffMenu
  2129.  
  2130.     bsr grabscreen
  2131.  
  2132. page2    move.l #text16,more+12
  2133.  
  2134.     move.w #0,d0
  2135.     move.l rastport,a1
  2136.     CALLGRAF SetDrMd    * Set JAM1
  2137.     move.l rastport,a1
  2138.     move.w #7,d0
  2139.     CALLGRAF SetAPen
  2140.  
  2141. newpage    move.l rastport,a1
  2142.     move.w #wleft,d0
  2143.     move.w #wtop,d1
  2144.     move.w #wleft+wwidth-1,d2
  2145.     move.w #wtop,d3
  2146.     add.w white,d3
  2147.     CALLGRAF RectFill
  2148.  
  2149.     move.l rastport,a0
  2150.     move.l #borderA,a1
  2151.     move.w #wleft,d0
  2152.     move.w #wtop,d1
  2153.     CALLINT DrawBorder
  2154.  
  2155.     move.w #wtop+8,d7
  2156. eachrow    move.l a5,lineoftext+12
  2157.     move.w #(wwidth-32)/8,d0
  2158. lookforspace cmp.b #254,(a5)
  2159.     bne notdn
  2160.     add.w #2,a5
  2161.     move.l himem,a0
  2162.     btst.b #1,270(a0)
  2163.     bne eachrow
  2164.     add.w #9,d7
  2165.     bra eachrow        
  2166. notdn    cmp.b #32,(a5)+
  2167.     bne notendofword
  2168.     tst.b (a5)
  2169.     beq there
  2170.     move.l a5,a0
  2171. notendofword dbf d0,lookforspace
  2172.     move.l a0,a5
  2173. there    clr.b -1(a5)
  2174.     move.w #wleft+20,d0
  2175.     move.w d7,d1
  2176.     move.l rastport,a0
  2177.     move.l #lineoftext,a1
  2178.     CALLINT PrintIText
  2179.     move.b #32,-1(a5)
  2180.     add.w #9,d7
  2181.         
  2182.     tst.b (a5)
  2183.     bne eachrow
  2184.  
  2185.     cmp.b #255,1(a5)        * NTSC smaller screen
  2186.     bne bigscreen1
  2187.     add.w #1,a5
  2188.     move.l himem,a0
  2189.     btst.b #1,270(a0)
  2190.     bne nottheend
  2191.  
  2192. bigscreen1 add.w #1,a5
  2193.     tst.b (a5)
  2194.     bne eachrow
  2195.  
  2196.     tst.b 1(a5)
  2197.     bne nottheend
  2198.     tst.b 2(a5)
  2199.     beq finito
  2200.     move.l #text18,more+12
  2201. nottheend move.l window,a0
  2202.     move.l #moregadget,a1
  2203.     move.l #-1,d0
  2204.     CALLINT AddGadget
  2205.     move.l window,a0
  2206.     move.l #cancelgadget,a1
  2207.     move.l #-1,d0
  2208.     CALLINT AddGadget
  2209.  
  2210.     move.l #moregadget,a0
  2211.     move.l window,a1
  2212.     sub.l a2,a2
  2213.     CALLINT RefreshGadgets
  2214.     
  2215. waitgg    move.l userport,a0
  2216.     clr.l d1
  2217.     move.b $0f(a0),d1
  2218.     moveq #1,d0
  2219.     asl.l d1,d0
  2220.     CALLEXEC Wait
  2221.     move.l userport,a0
  2222.     CALLEXEC GetMsg
  2223.     tst.l d0
  2224.     beq waitgg
  2225.     move.l d0,a1
  2226.     move.l $14(a1),d4
  2227.     move.w $18(a1),d5
  2228.     move.l $1c(a1),a4
  2229.     CALLEXEC ReplyMsg
  2230.     cmp.w #$0100,d4    * MENUPICK
  2231.     bne gad
  2232.     cmp.w #$ffff,d5    * MENUNULL
  2233.     beq waitgg
  2234.     and.w #$7ff,d5
  2235.     cmp.w #$60,d5
  2236.     beq quit
  2237.     bra waitgg
  2238. gad    cmp.w #1,38(a4)
  2239.     beq gotmore
  2240.     cmp.w #2,38(a4)
  2241.     bne waitgg
  2242.     bra gotcancel
  2243. gotmore bsr gogadgetgo
  2244.     add.w #1,a5
  2245.     tst.b (a5)
  2246.     bne newpage
  2247.     bra gotcancel    
  2248.  
  2249. gogadgetgo move.l window,a0
  2250.     move.l #moregadget,a1
  2251.     CALLINT RemoveGadget
  2252.     move.l window,a0
  2253.     move.l #cancelgadget,a1
  2254.     CALLINT RemoveGadget
  2255.  
  2256. finito    rts
  2257.  
  2258. gotcancel bsr gogadgetgo
  2259.  
  2260.     move.l window,a0
  2261.     move.w #$7e1,d0
  2262.     CALLINT OnMenu        * Options menu
  2263.     move.l window,a0
  2264.     move.w #$7e2,d0
  2265.     CALLINT OnMenu        * game menu
  2266.     move.l window,a0
  2267.     move.w #$7e3,d0
  2268.     CALLINT OnMenu        * Help menu
  2269.     move.l window,a0
  2270.     move.w #0,d0
  2271.     CALLINT OnMenu
  2272.     move.l window,a0
  2273.     move.w #$20,d0
  2274.     CALLINT OnMenu
  2275.     move.l window,a0
  2276.     move.w #$40,d0
  2277.     CALLINT OnMenu
  2278.  
  2279.     bsr pushscreen
  2280.     move.l window,a0
  2281.     move.l #klondike,a1
  2282.     CALLINT SetMenuStrip
  2283.  
  2284.     move.l #seconds,a0
  2285.     move.l #micros,a1
  2286.     CALLINT CurrentTime
  2287.     move.l seconds,oldsecs
  2288.     
  2289.     rts
  2290.  
  2291.  
  2292. ***** Display the hi-scores *****
  2293.  
  2294. hleft    equ 204
  2295. hhiteP    equ 220
  2296. hhiteN    equ 188
  2297. hwidth    equ 232
  2298.  
  2299. printhiscores 
  2300.  
  2301.     move.l himem,a0
  2302.  
  2303.     clr.w d0
  2304.     move.b 271(a0),d0
  2305.     tst.b d0
  2306.     bra keeplaying        * Delete line for V1.1b & c
  2307.     beq keeplaying
  2308.     
  2309. ** insert last name entered into text
  2310.  
  2311.     mulu.w #18,d0
  2312.     sub.w #13,d0
  2313.     add.w d0,a0
  2314.     move.l #guilty1+66,a1
  2315.     move.l #guilty2+21,a2
  2316.     move.w #9,d1
  2317. insert    move.b (a0),(a1)+
  2318.     move.b (a0)+,(a2)+
  2319.     dbf d1,insert
  2320.     
  2321.     move.l #message,a5
  2322.     move.l himem,a0
  2323.     btst.b #1,270(a0)
  2324.     beq PALmessage
  2325.     move.l #message2,a5
  2326. PALmessage bsr page2
  2327.     rts
  2328.  
  2329. keeplaying move.l #lastscore,a0
  2330.     CALLINT IntuiTextLength
  2331.     move.w #hleft+30,d5
  2332.     sub.w d0,d5
  2333.     lsr.w #1,d5
  2334.     move.w d5,lastscore+4
  2335.     subq #2,d5
  2336.     move.w d5,lastscore2+4
  2337.  
  2338.     move.l #gamespld2,a1
  2339.     move.w games,d0
  2340.     bsr donumber2
  2341.     clr.b (a1) 
  2342.  
  2343.     move.l #gamesdone,a0
  2344.     CALLINT IntuiTextLength
  2345.     move.w #hleft+30,d5
  2346.     sub.w d0,d5
  2347.     lsr.w #1,d5
  2348.     move.w d5,gamesdone+4
  2349.     subq #2,d5
  2350.     move.w d5,gamesdone2+4
  2351.  
  2352.     clr.w d0
  2353.     move.l rastport2,a1
  2354.     CALLGRAF SetDrMd    * Set JAM1
  2355.     move.l rastport2,a1
  2356.     clr.w d0
  2357.     CALLGRAF SetAPen
  2358.  
  2359.     move.l rastport2,a1
  2360.     move.w #hleft,d0
  2361.     move.w htop,d1
  2362.     move.w #hleft+hwidth-1,d2
  2363.     move.w htop,d3
  2364.     add.w hhite,d3
  2365.     subq #1,d3
  2366.     CALLGRAF RectFill
  2367.  
  2368.     move.l rastport2,a0
  2369.     move.l #border,a1
  2370.     move.w #hleft,d0
  2371.     move.w htop,d1
  2372.     CALLINT DrawBorder
  2373.  
  2374.     move.l rastport2,a0
  2375.     move.l #titler,a1
  2376.     move.w #hleft,d0
  2377.     move.w htop,d1
  2378.     CALLINT PrintIText
  2379.     
  2380.     move.l himem,a4
  2381.     move.b #32,4(a4)
  2382.     move.w name1pos,d7
  2383.     move.w #14,d6
  2384.     move.b #4,name
  2385.     move.l #font2,fontys
  2386.     move.l #namea,nextname
  2387. dothem    move.w 16(a4),d0
  2388.     bsr donumber
  2389.     clr.b (a1)
  2390.     cmp.b #14,d6
  2391.     bne missth
  2392.     move.l #storage,namepos
  2393.     move.l #name,a0
  2394.     CALLINT IntuiTextLength
  2395.     move.w #64,d5
  2396.     sub.w d0,d5
  2397.     lsr.w #1,d5
  2398. missth    move.w d5,d0
  2399.     move.w d7,d1
  2400.     add.w htop,d1
  2401.     move.l rastport2,a0
  2402.     move.l #name,a1
  2403.     move.l a4,namepos
  2404.     move.l a4,namepos2
  2405.     CALLINT PrintIText
  2406.     
  2407.     move.l rastport2,a0
  2408.     move.l #name,a1
  2409.     move.w #129,d0
  2410.     cmp.w #14,d6
  2411.     bne yobo
  2412.     move.w #160,d0
  2413. yobo    add.w d5,d0
  2414.     move.w d7,d1
  2415.     add.w htop,d1
  2416.     move.l #storage,namepos
  2417.     move.l #storage,namepos2
  2418.     CALLINT PrintIText
  2419.  
  2420.     move.w #36,d5
  2421.     move.l #font,fontys
  2422.     clr.l nextname
  2423.     
  2424.     cmp.w #14,d6
  2425.     bne notdown2
  2426.     add.w name2down,d7
  2427.  
  2428.     move.l #bitmap2,a0
  2429.     move.l 16(a0),a2
  2430.     move.w htop,d0
  2431.     add.w name1pos,d0
  2432.     mulu.w #80,d0
  2433.     add.w #26,d0
  2434.     add.w d0,a2
  2435.     move.l a2,a3
  2436.     sub.w #80*10,a3
  2437.     move.l 12(a0),a0
  2438.     add.w d0,a0
  2439.     move.l a0,a1
  2440.     sub.w #80*10,a1
  2441.  
  2442.     move.w #8,d0
  2443. double1    move.w #26,d1
  2444. double2    move.b (a0),(a1)+
  2445.     move.b (a0)+,79(a1)
  2446.     move.b (a2),(a3)+
  2447.     move.b (a2)+,79(a3)
  2448.     dbf d1,double2
  2449.     add.w #53,a0
  2450.     add.w #53+80,a1
  2451.     add.w #53,a2
  2452.     add.w #53+80,a3
  2453.  
  2454.     dbf d0,double1
  2455.  
  2456. notdown2 add.w #18,a4
  2457.     move.b #1,name
  2458.     cmp.b #32,4(a4)
  2459.     beq normalcol
  2460.     move.b #32,4(a4)
  2461.     move.b #2,name        * change colour
  2462. normalcol add.w #9,d7
  2463.     dbf d6,dothem
  2464.  
  2465.     move.l #bitmap2,a0
  2466.     move.w #hleft,d0
  2467.     move.w htop,d1
  2468.     move.l rastport,a1
  2469.     move.w d0,d2
  2470.     move.w d1,d3
  2471.     move.w #hwidth,d4
  2472.     move.w hhite,d5
  2473.     move.w #$c0,d6
  2474.     CALLGRAF BltBitMapRastPort
  2475.  
  2476.     rts
  2477.  
  2478.  
  2479. ***** replace 3rd bitplane of card in A4 clipping out move card *****
  2480.  
  2481. replacehi bsr ownblitter
  2482.     move.l #$dff000,a5
  2483.     move.l #$09f00000,$040(a5)
  2484.     move.l #-1,$044(a5)
  2485.  
  2486.     move.w (a4),d0
  2487.     move.w 2(a4),d1
  2488.     mulu.w #80,d1
  2489.     move.w d0,d2
  2490.     lsr.w #3,d2
  2491.     bclr #0,d2
  2492.     add.w d2,d1    * d1=offset into bitplane
  2493.     move.w d1,hiliteoffset
  2494.  
  2495.     move.w #46,d7
  2496.     move.w hiliteoffset,d6
  2497.     move.w newy,d0
  2498.     sub.w 2(a4),d0
  2499.     beq notys
  2500.     bcs aboves
  2501.     cmp.w #46,d0
  2502.     bls goodsize
  2503.     move.w #46,d0
  2504. goodsize sub.w d0,d7
  2505.     move.w d0,d1
  2506.     mulu.w #80,d1
  2507.     add.w d1,d6 
  2508.     move.w hiliteoffset,d1 
  2509.     bra drawhorz
  2510.  
  2511. aboves    neg.w d0
  2512.     cmp.w #46,d0
  2513.     bls goodsize2
  2514.     move.w #46,d0
  2515. goodsize2 move.w #46,d1
  2516.     sub.w d0,d7
  2517.     sub.w d0,d1
  2518.     mulu.w #80,d1
  2519.     add.w hiliteoffset,d1
  2520. drawhorz move.l #$00460046,$064(a5)
  2521.     move.l wherefrom,a0
  2522.     move.l whereto,a1
  2523.     add.w d1,a0
  2524.     move.l a0,$050(a5)
  2525.     add.w d1,a1
  2526.     move.l a1,$054(a5)
  2527.     mulu.w #64,d0
  2528.     add.w #5,d0
  2529.     move.w d0,$058(a5)
  2530.     bsr waitblit
  2531.  
  2532.  
  2533. notys    move.w (a4),d0
  2534.     and.w #$fff0,d0
  2535.     sub.w newx,d0
  2536.     beq notxs
  2537.     bcc leftie
  2538.     neg.w d0
  2539.     lsr.w #4,d0
  2540.     cmp.w #5,d0
  2541.     bls goodsize3
  2542.     move.w #5,d0
  2543. goodsize3 mulu.w #64,d7
  2544.     beq notxs
  2545.     add.w d0,d7
  2546.     lsl.w #1,d0
  2547.     neg.w d0
  2548.     add.w #80,d0
  2549.     move.w d0,$064(a5)
  2550.     move.w d0,$066(a5)
  2551.     bra drawvert
  2552.  
  2553. leftie    lsr.w #4,d0
  2554.     cmp.w #5,d0
  2555.     bls goodsize4
  2556.     move.w #5,d0
  2557. goodsize4 mulu.w #64,d7
  2558.     beq notxs
  2559.     add.w d0,d7
  2560.     lsl.w #1,d0
  2561.     neg.w d0
  2562.     add.w #10,d0
  2563.     add.w d0,d6
  2564.     add.w #70,d0
  2565.     move.w d0,$064(a5)
  2566.     move.w d0,$066(a5)
  2567. drawvert move.l wherefrom,a0
  2568.     move.l whereto,a1
  2569.     add.w d6,a0
  2570.     move.l a0,$050(a5)
  2571.     add.w d6,a1
  2572.     move.l a1,$054(a5)
  2573.     move.w d7,$058(a5)
  2574.     bsr waitblit
  2575.  
  2576. notxs    CALLGRAF DisownBlitter
  2577.  
  2578.     rts
  2579.  
  2580.  
  2581. ***** Calculate the height of the selected column (a4=table) *****
  2582.  
  2583. gotcard    move.l tablememory,a0
  2584.     clr.w d0
  2585.     move.b 4(a4),d1
  2586.     move.w #63,d2
  2587. last    cmp.b 4(a0),d1
  2588.     bne nottcol    
  2589.     cmp.b 5(a0),d0
  2590.     bhi nottcol
  2591.     move.b 5(a0),d0
  2592.     move.l a0,a1    
  2593. nottcol add.w #10,a0
  2594.     dbf d2,last
  2595.  
  2596. * a1=last card in column
  2597.  
  2598.     clr.w d0
  2599.     move.b 5(a1),d0
  2600.     sub.b 5(a4),d0    * no. of cards to shift-1
  2601.     move.w d0,numcards
  2602.     move.w #46,d1
  2603.     tst.b d0
  2604.     beq gothite
  2605.     add.w #10,d1
  2606.     subq #1,d0
  2607.     beq gothite
  2608.     mulu.w gapB,d0
  2609.     add.w d0,d1
  2610. gothite move.w d1,moveheight        * Height
  2611.  
  2612. ** create the mask for height in moveheight **
  2613.  
  2614.     move.l a4,movecard
  2615.     move.l movememory,a0
  2616.     move.l cardmask2,a1
  2617.     move.l (a1)+,(a0)+
  2618.     move.l (a1)+,(a0)+
  2619.     move.l (a1)+,(a0)+
  2620.     move.l (a1)+,(a0)+
  2621.     move.l (a1)+,(a0)+
  2622.     move.l (a1)+,(a0)+
  2623.     move.l (a1)+,d1
  2624.     move.l (a1),d2
  2625.     move.w moveheight,d0
  2626.     sub.w #7,d0
  2627. middle    move.l d1,(a0)+
  2628.     move.l d2,(a0)+
  2629.     dbf d0,middle
  2630.     add.w #316,a1
  2631.     move.l (a1)+,(a0)+
  2632.     move.l (a1)+,(a0)+
  2633.     move.l (a1)+,(a0)+
  2634.     move.l (a1)+,(a0)+
  2635.     move.l (a1)+,(a0)+
  2636.     move.l (a1)+,(a0)+
  2637.  
  2638.  
  2639. ** grab the cards using the mask **    
  2640.  
  2641.     bsr ownblitter
  2642.     move.l #$dff000,a5
  2643.  
  2644.     move.w (a4),d0
  2645.     move.w 2(a4),d1
  2646.     move.w d1,newy
  2647.  
  2648.     mulu.w #80,d1
  2649.     move.w d0,d2
  2650.     lsr.w #3,d2
  2651.     bclr #0,d2
  2652.     add.w d2,d1    * d1=offset into bitplane
  2653.     move.w d1,moveoffset
  2654.     lsl.w #3,d2
  2655.     move.w d0,d3
  2656.     move.w d2,newx
  2657.     sub.w d2,d3
  2658.     lsl.w #4,d3
  2659.     lsl.w #8,d3
  2660.     move.w d3,moveshift
  2661.     
  2662.     sub.w d0,d2    * d0=pixels to shift right
  2663.     add.w #16,d2    
  2664.  
  2665.     lsl.w #4,d2
  2666.     lsl.w #8,d2
  2667.  
  2668.     add.w #$ba0,d2        * use A,C & D    
  2669.     move.w d2,$040(a5)    * Control 0
  2670.     clr.w $042(a5)        * Control 1        
  2671.  
  2672.     move.l bitmap,a1
  2673.     add.w #8,a1
  2674.     clr.w $066(a5)        * D modulo
  2675.     move.w #-2,$060(a5)    * C modulo
  2676.     move.w #70,$064(a5)    * A modulo
  2677.     move.l #-1,$044(a5)    * Masks
  2678.  
  2679.     move.w #2,d0    
  2680.     move.w moveheight,d2
  2681.     mulu.w #64,d2
  2682.     add.w #5,d2    
  2683.     move.l movememory,a0
  2684.     move.l a0,a3
  2685.     sub.w #2,a3
  2686.     add.l #maxplane,a0
  2687.  
  2688. loop1    move.l (a1)+,a2
  2689.     add.w d1,a2
  2690.     move.l a2,$050(a5)    * Source A
  2691.     move.l a3,$048(a5)    * Source C (mask)
  2692.     move.l a0,$054(a5)    * Destination
  2693.     add.l #maxplane,a0    
  2694.  
  2695.     move.w d2,$058(a5)     * Blit a bitplane
  2696.     bsr waitblit
  2697.     dbf d0,loop1
  2698.  
  2699. ** Clear the column selected **
  2700.  
  2701.     move.w #-2,$064(a5)    * A modulo
  2702.     move.w #70,$060(a5)    * C modulo
  2703.     move.w #70,$066(a5)    * D modulo
  2704.     move.w moveshift,d0
  2705.     add.w #$b0a,d0
  2706.     move.w d0,$040(a5)
  2707.     clr.w $042(a5)
  2708.     move.l #$ffff0000,$044(a5)    * mask
  2709.  
  2710.     move.w moveheight,d0
  2711.     mulu.w #64,d0
  2712.     add.w #5,d0
  2713.     move.w d0,movesize
  2714.     move.l #bitmap2+8,a0
  2715.     move.w #2,d1
  2716. ridit    move.l (a0)+,a1
  2717.     add.w moveoffset,a1
  2718.     move.l a1,$048(a5)
  2719.     move.l a1,$054(a5)
  2720.     move.l movememory,$050(a5)
  2721.     move.w d0,$058(a5)
  2722.     bsr waitblit
  2723.     dbf d1,ridit
  2724.  
  2725.     CALLGRAF DisownBlitter
  2726.  
  2727. ** find the previous card in the pile **
  2728.  
  2729.     move.l movecard,a0
  2730.     move.b 5(a0),d1
  2731.     move.b d1,d5
  2732.     cmp.b #9,4(a0)
  2733.     bne nobby
  2734.     cmp.b #1,d1
  2735.     beq redrawn
  2736.     move.b #1,d1
  2737.     bra notaspc
  2738. nobby    sub.b #1,d1
  2739.     bne notaspc
  2740.     cmp.b #9,4(a0)
  2741.     bls redrawn
  2742. notaspc    move.b 4(a0),d0
  2743.     move.l tablememory,a1
  2744. previous cmp.b 5(a1),d1
  2745.     bne nextplease        * not one less 
  2746.     cmp.b 4(a1),d0
  2747.     beq foundit        * same column
  2748. nextplease add.w #10,a1
  2749.     bra previous
  2750.  
  2751. foundit cmp.b #9,4(a1)
  2752.     bne onlyone
  2753.     move.b d1,d6
  2754. drawthem move.l bitmap,d7
  2755.     move.l #bitmap2,bitmap * Use other screen
  2756.     bsr fromtable        * get a0 value
  2757.     bsr drawcard        * Draw card
  2758.     move.l d7,bitmap
  2759.     addq #1,d6
  2760.     move.l tablememory,a1
  2761. morer    cmp.b 5(a1),d6
  2762.     bne nextyes        * not one more
  2763.     cmp.b #9,4(a1)
  2764.     beq foundd        * same column
  2765. nextyes    add.w #10,a1
  2766.     bra morer
  2767. foundd    cmp.b 5(a1),d5
  2768.     bne drawthem
  2769.     bra redrawn
  2770.  
  2771. onlyone    move.l bitmap,d7
  2772.     move.l #bitmap2,bitmap * Use other screen
  2773.     bsr fromtable        * get a0 value
  2774.     bsr drawcard        * Draw card
  2775.     move.l d7,bitmap
  2776.  
  2777. redrawn 
  2778.     rts
  2779.  
  2780.  
  2781. ***** Draw the column of cards at position in moveoffset *****
  2782.  
  2783. slaponcards bsr ownblitter
  2784.     move.l #$dff000,a5
  2785.  
  2786.     move.w moveshift,d0
  2787.     move.w d0,$042(a5)    * Control 1
  2788.  
  2789.     add.w #$0fca,d0    * use A,B,C & D    
  2790.     move.w d0,$040(a5)    * Control 0
  2791.         
  2792.     move.l bitmap,a1
  2793.     add.w #8,a1
  2794.     move.w #70,$060(a5)    * C modulo
  2795.     move.w #70,$066(a5)    * D modulo
  2796.     move.l #$0000fffe,$062(a5)    * A & B modulos
  2797.     move.l #$ffff0000,$044(a5)    * Masks
  2798.  
  2799.     move.w #2,d0    
  2800.     move.l movememory,a0
  2801.     add.w #maxplane+2,a0
  2802.     move.l #bitmap2+8,a3
  2803.  
  2804. slap    move.l movememory,$050(a5) * Source A (mask)
  2805.     move.l a0,$04c(a5)    * Source B
  2806.     add.w #maxplane,a0
  2807.     move.l (a3)+,a2
  2808.     add.w moveoffset,a2
  2809.     move.l a2,$048(a5)    * Source C
  2810.     move.l (a1)+,a2
  2811.     add.w moveoffset,a2
  2812.     move.l a2,$054(a5)    * Destination
  2813.     
  2814.     move.w movesize,$058(a5) * Blit a bitplane
  2815.     bsr waitblit
  2816.     dbf d0,slap
  2817.  
  2818.     CALLGRAF DisownBlitter
  2819.     
  2820.     rts
  2821.  
  2822.  
  2823.  
  2824. ***** Calculate the columns new position *****
  2825.  
  2826. newpos    move.l window,a0
  2827.     move.w $0e(a0),d0    * wd_mouseX
  2828.     move.w $0c(a0),d1    * wd_mouseY
  2829.     sub.w movex,d0
  2830.     bcc notooleft
  2831.     clr.w d0
  2832. notooleft cmp.w #640-56,d0
  2833.     bls notoorite
  2834.     move.w #640-56,d0
  2835. notoorite sub.w movey,d1
  2836.     bcs tooup
  2837.     cmp.w #11,d1
  2838.     bhi notooup
  2839. tooup    move.w #11,d1
  2840. notooup move.w d1,d2
  2841.     add.w moveheight,d2
  2842.     move.w scrheight,d3
  2843.     subq #1,d3
  2844.     cmp.w d3,d2
  2845.     bls forcenewpos
  2846.     move.w d3,d1
  2847.     sub.w moveheight,d1
  2848. forcenewpos move.w newx,oldx
  2849.     move.w newy,oldy
  2850.     move.w d1,newy
  2851.     move.w d0,properx
  2852.     mulu.w #80,d1
  2853.     move.w d0,d2
  2854.     lsr.w #3,d2
  2855.     bclr #0,d2
  2856.     add.w d2,d1    * d1=offset into bitplane
  2857.     move.w moveoffset,oldoffset
  2858.     move.w d1,moveoffset
  2859.     lsl.w #3,d2
  2860.     move.w d2,newx
  2861.     sub.w d2,d0
  2862.     lsl.w #4,d0
  2863.     lsl.w #8,d0
  2864.     move.w d0,moveshift
  2865.     rts
  2866.     
  2867.  
  2868. ***** Copy the whole screen onto bitmap2 *****
  2869.  
  2870. grabscreen move.l bitmap,a0
  2871.     move.l rastport2,a1
  2872.     bra movescreen
  2873.  
  2874. ***** Replace the whole screen back to bitmap *****
  2875.  
  2876. pushscreen move.l #bitmap2,a0
  2877.     move.l rastport,a1
  2878. movescreen clr.w d0
  2879.     move.w #10,d1
  2880.     clr.w d2
  2881.     move.w d1,d3
  2882.     move.w #640,d4
  2883.     move.w #maxscrheight-10,d5
  2884.     move.w #$c0,d6
  2885.     CALLGRAF BltBitMapRastPort
  2886.     rts
  2887.  
  2888.  
  2889. ***** Replace the background *****
  2890.  
  2891. background bsr ownblitter
  2892.     move.l #$dff000,a5
  2893.     
  2894.     move.w moveheight,d7
  2895.     move.w oldoffset,d6
  2896.     move.w newy,d1
  2897.     sub.w oldy,d1
  2898.     beq noychange
  2899.     bcs goneup
  2900.     move.w oldoffset,d2
  2901.     cmp.w moveheight,d1
  2902.     bls notoobig
  2903.     move.w moveheight,d1
  2904. notoobig move.w d1,d4
  2905.     mulu.w #80,d4
  2906.     add.w d4,d6
  2907.     bra replace    
  2908.  
  2909. goneup    neg.w d1
  2910.     cmp.w moveheight,d1
  2911.     bls notoohigh
  2912.     move.w moveheight,d1
  2913. notoohigh move.w moveheight,d2
  2914.     sub.w d1,d2
  2915.     mulu.w #80,d2
  2916.     add.w oldoffset,d2
  2917.  
  2918. replace    sub.w d1,d7 
  2919.     beq fullone
  2920.     bcc notfull
  2921. fullone    clr.w d7
  2922. notfull    mulu.w #64,d1
  2923.     add.w #5,d1
  2924.     move.w #70,$066(a5)        * D modulo
  2925.     move.w #70,$064(a5)        * A modulo
  2926.     move.l #$09f00000,$040(a5)    * Controls
  2927.     move.l #-1,$044(a5)        * masks
  2928.  
  2929.     move.l bitmap,a0
  2930.     add.w #8,a0
  2931.     move.w #2,d0
  2932.     move.l #bitmap2+8,a1
  2933. pushback move.l (a0)+,a2
  2934.     add.w d2,a2
  2935.     move.l a2,$054(a5)    * Destination
  2936.     move.l (a1)+,a2
  2937.     add.w d2,a2
  2938.     move.l a2,$050(a5)    * Source A
  2939.     move.w d1,$058(a5)
  2940.     bsr waitblit
  2941.     dbf d0,pushback
  2942.  
  2943. noychange move.w newx,d0
  2944.     sub.w oldx,d0
  2945.     beq noxmove
  2946.     bcs goesleft
  2947.  
  2948.     lsr.w #4,d0
  2949.     cmp.w #5,d0
  2950.     bls nottoobigg
  2951.     move.w #5,d0
  2952. nottoobigg mulu.w #64,d7
  2953.     beq noxmove
  2954.     add.w d0,d7
  2955.     lsl.w #1,d0
  2956.     neg.w d0
  2957.     add.w #80,d0
  2958.  
  2959.     bra replace2
  2960.  
  2961. goesleft neg.w d0
  2962.     lsr.w #4,d0
  2963.     cmp.w #5,d0
  2964.     bls nottoobiggg
  2965.     move.w #5,d0
  2966. nottoobiggg mulu.w #64,d7    
  2967.     beq noxmove
  2968.     add.w d0,d7
  2969.     lsl.w #1,d0
  2970.     neg.w d0
  2971.     add.w #10,d0
  2972.     add.w d0,d6
  2973.     add.w #70,d0
  2974.     bra replace2
  2975.  
  2976. replace2 move.w d0,$066(a5)        * D modulo
  2977.     move.w d0,$064(a5)        * A modulo
  2978.     move.l #$09f00000,$040(a5)    * Controls
  2979.     move.l #-1,$044(a5)        * masks
  2980.  
  2981.     move.l bitmap,a0
  2982.     add.w #8,a0
  2983.     move.w #2,d0
  2984.     move.l #bitmap2+8,a1
  2985. pushback2 move.l (a0)+,a2
  2986.     add.w d6,a2
  2987.     move.l a2,$054(a5)    * Destination
  2988.     move.l (a1)+,a2
  2989.     add.w d6,a2
  2990.     move.l a2,$050(a5)    * Source A
  2991.     move.w d7,$058(a5)
  2992.     bsr waitblit
  2993.     dbf d0,pushback2
  2994.     
  2995. noxmove
  2996.  
  2997.     CALLGRAF DisownBlitter
  2998.     
  2999.     rts
  3000.  
  3001.  
  3002. ***** Find last card & 1st upturned cards in column & set select bits *****
  3003.  
  3004. select    move.w #1,d0
  3005. findlast2 move.l tablememory,a0
  3006.     clr.w d1
  3007.     clr.w d2
  3008.     move.w #63,d3
  3009. findlast cmp.b 4(a0),d0
  3010.     bne notincol    
  3011.     cmp.b 5(a0),d1
  3012.     bhi noupdate
  3013.     move.b 5(a0),d1
  3014.     move.l a0,a1    
  3015. noupdate cmp.b 5(a0),d2
  3016.     bhi notincol
  3017.     btst.b #0,7(a0)
  3018.     beq notincol
  3019.     move.b 5(a0),d2
  3020. notincol add.w #10,a0
  3021.     dbf d3,findlast
  3022.  
  3023. * a1=last card in column
  3024. * d2=number of face downs in column
  3025.  
  3026.     tst.b 5(a1)
  3027.     bne notlast
  3028.     cmp.b #8,4(a1) 
  3029.     bne noneincol
  3030. notlast    bset.b #1,7(a1)
  3031.     cmp.b #7,d0
  3032.     bhi noneincol
  3033.  
  3034.     move.l tablememory,a0
  3035.     add.b #1,d2
  3036.     move.w #63,d3
  3037. lookfor cmp.b 4(a0),d0
  3038.     bne nothere
  3039.     cmp.b 5(a0),d2
  3040.     beq yahoo
  3041. nothere    add.w #10,a0
  3042.     dbf d3,lookfor
  3043.     bra noneincol
  3044. yahoo    btst.b #0,7(a0)
  3045.     bne noneincol
  3046.     btst.b #1,7(a0)
  3047.     bne noneincol
  3048.     bset.b #2,7(a0)
  3049.     bset.b #4,7(a1)
  3050.  
  3051. noneincol addq #1,d0
  3052.     cmp.b #13,d0
  3053.     bls findlast2
  3054.  
  3055.     rts
  3056.  
  3057.  
  3058.  
  3059. ***** Find last card in columns *****
  3060.  
  3061. select2    move.l movecard,a4
  3062.     move.w #1,d0
  3063.     move.b 8(a4),d2
  3064.     add.b #1,d2
  3065.  
  3066. findlasty2 move.l tablememory,a0
  3067.     clr.w d1
  3068.     move.w #63,d3
  3069. findlasty cmp.b 4(a0),d0
  3070.     bne noupdated
  3071.     cmp.b 5(a0),d1
  3072.     bhi noupdated
  3073.     move.b 5(a0),d1
  3074.     move.l a0,a1    
  3075. noupdated add.w #10,a0
  3076.     dbf d3,findlasty
  3077.  
  3078. * a1=last card in column
  3079.  
  3080.     cmp.b #7,d0
  3081.     bls tableau
  3082. ** a1 is top of a foundation **
  3083.  
  3084.     move.b 8(a4),d1
  3085.     subq #1,d1
  3086.     cmp.b 8(a1),d1
  3087.     bne cantgohere
  3088.     tst.b d1
  3089.     beq setbitt
  3090.     move.b 9(a4),d1
  3091.     cmp.b 9(a1),d1
  3092.     bne cantgohere
  3093.     tst.w numcards    * columns of cards can't go on foundations
  3094.     bne cantgohere
  3095.     bra setbitt
  3096.  
  3097. tableau    tst.b 5(a1)
  3098.     beq IsitaKing
  3099.     cmp.b 8(a1),d2
  3100.     bne cantgohere
  3101.     btst.b #0,9(a4)
  3102.     bne selred
  3103.     btst.b #0,9(a1)
  3104.     beq cantgohere
  3105.     bra setbitt
  3106.  
  3107. selred    btst.b #0,9(a1)
  3108.     bne cantgohere
  3109.  
  3110. setbitt    btst.b #0,7(a1)
  3111.     bne cantgohere
  3112.     bset.b #3,7(a1)
  3113.     bra cantgohere
  3114.  
  3115. IsitaKing cmp.b #13,8(a4)
  3116.     beq setbitt
  3117.  
  3118. cantgohere addq #1,d0
  3119.     cmp.b #7,d0
  3120.     bls findlasty2
  3121.     cmp.b #8,d0
  3122.     bne noskip
  3123.     move.b #10,d0
  3124. noskip    cmp.b #13,d0
  3125.     bls findlasty2
  3126.  
  3127.     rts
  3128.  
  3129.  
  3130.  
  3131. ***** Check if mouse is over a select card *****
  3132.  
  3133. checkselect move.l window,a0
  3134.     move.w $0e(a0),d0    * wd_mouseX
  3135.     move.w $0c(a0),d1    * wd_mouseY
  3136.     move.l tablememory,a0
  3137.     move.w #63,d2
  3138. findsel move.b 7(a0),d3
  3139.     and.b #6,d3
  3140.     beq notsel
  3141.     cmp.w (a0),d0
  3142.     bls notsel
  3143.     move.w (a0),d4
  3144.     add.w #52,d4
  3145.     cmp.w d4,d0
  3146.     bhi notsel
  3147.     
  3148.     cmp.w 2(a0),d1
  3149.     bls notsel
  3150.     move.w 2(a0),d4
  3151.     add.w #10,d4
  3152.     btst.b #2,7(a0)
  3153.     bne colo
  3154.     add.w #34,d4
  3155. colo    cmp.w d4,d1
  3156.     bhi notsel
  3157.     move.l a0,a4    * a4 points to card selected
  3158.     move.w d0,d2
  3159.     sub.w (a4),d2
  3160.     move.w d2,movex
  3161.     move.w d1,d2
  3162.     sub.w 2(a4),d2
  3163.     move.w d2,movey
  3164.     bra doneok
  3165.  
  3166. notsel    add.w #10,a0
  3167.     dbf d2,findsel
  3168.     sub.l a4,a4    * a4 is zero - not over card
  3169.  
  3170. doneok
  3171.     rts
  3172.  
  3173.  
  3174.  
  3175. ***** Check if mouse can put card down *****
  3176.  
  3177. checkselect2 move.w properx,d0
  3178.     move.w newy,d1
  3179.     clr.w d6
  3180.     move.l tablememory,a0
  3181.     move.w #63,d2
  3182. finddown btst.b #3,7(a0)
  3183.     beq notsel2
  3184.     move.w (a0),d4
  3185.     cmp.w d0,d4
  3186.     bls torite
  3187.     move.w d0,d5
  3188.     add.w #52,d5
  3189.     sub.w d4,d5
  3190.     bcs notsel2
  3191.     bra gotxval
  3192. torite    move.w d4,d5
  3193.     add.w #52,d5
  3194.     sub.w d0,d5
  3195.     bcs notsel2
  3196.  
  3197. gotxval    move.w 2(a0),d4
  3198.     sub.w #44,d4
  3199.     bcs misss
  3200.     cmp.w d4,d1
  3201.     bls notsel2
  3202. misss    move.w 2(a0),d4
  3203.     add.w #43,d4
  3204.     cmp.w d4,d1
  3205.     bhi notsel2
  3206.  
  3207.     cmp.w d5,d6
  3208.     bhi notsel2
  3209.     move.w d5,d6
  3210.     move.l a0,a4    * a4 points to card selected
  3211.  
  3212. notsel2    add.w #10,a0
  3213.     dbf d2,finddown
  3214.     tst.w d6
  3215.     bne gotone
  3216.     sub.l a4,a4    * a4 is zero - not over card
  3217. gotone
  3218.  
  3219.     rts
  3220.  
  3221.  
  3222. ***** Save the hi-scores *****
  3223.  
  3224. savescores bsr checksum
  3225.     move.l himem,a0
  3226.     move.l d1,272(a0)
  3227.     move.w games,276(a0)
  3228.     bsr scramble
  3229.     
  3230.     move.l #filename2,d1
  3231.     move.l #1006,d2
  3232.     CALLDOS Open
  3233.     tst.l d0
  3234.     beq savefail1
  3235.     move.l d0,file
  3236.  
  3237.     move.l file,d1
  3238.     move.l himem,d2
  3239.     move.l #hiscrsize,d3
  3240.     CALLDOS Write
  3241.     cmp.l d0,d3
  3242.     bne savefail2
  3243.  
  3244. savefail2 move.l file,d1
  3245.     CALLDOS Close
  3246.     
  3247. savefail1 bsr unscramble
  3248.     move.l screen,a0
  3249.     CALLINT ScreenToFront
  3250.  
  3251.     rts
  3252.  
  3253. ***** Load the sounds file into memory *****
  3254.  
  3255. loadsounds move.l #filename3,d1
  3256.     move.l soundmem,d4
  3257.     move.l #soundsize,d3
  3258.     bra load
  3259.     
  3260.  
  3261. ***** Load the hi-scores into memory *****
  3262.  
  3263. loadscores move.l himem,d4
  3264.     move.l #filename2,d1
  3265.     move.l #hiscrsize,d3
  3266.     bsr load
  3267.     bne loaderror
  3268.  
  3269.     bsr unscramble
  3270.     bsr checksum
  3271.     move.l himem,a0
  3272.     cmp.l 272(a0),d1
  3273.     bne loaderror
  3274.     move.w 276(a0),games
  3275.     moveq #0,d0
  3276.     rts
  3277.  
  3278. newscores    * reset hiscores
  3279.  
  3280. loaderror move.l #hiscores,a0
  3281.     move.l himem,a1
  3282.     move.b 270(a1),d7
  3283.     move.w #138,d0
  3284. newscores2 move.w (a0)+,(a1)+
  3285.     dbf d0,newscores2
  3286.     move.l himem,a1
  3287.     move.b d7,270(a1)
  3288.     clr.w games
  3289.     moveq #1,d0
  3290.     rts
  3291.  
  3292.  
  3293. scramble move.l himem,a0
  3294.     move.w #134,d0
  3295. scram1    move.w 2(a0),d1
  3296.     eor.w d1,(a0)+
  3297.     dbf d0,scram1
  3298.     rts
  3299.  
  3300. unscramble move.l himem,a0
  3301. unscramble2 add.w #270,a0 
  3302.     move.w #134,d0
  3303. scram2    move.w (a0),d1
  3304.     eor.w d1,-(a0)
  3305.     dbf d0,scram2
  3306.     rts
  3307.  
  3308. load    move.l #1005,d2
  3309.     CALLDOS Open
  3310.     tst.l d0
  3311.     beq openfail2
  3312.     move.l d0,file
  3313.  
  3314.     move.l file,d1
  3315.     move.l d4,d2
  3316.  
  3317.     CALLDOS Read
  3318.     cmp.l d0,d3
  3319.     bne readfail2
  3320.     
  3321.     move.l file,d1
  3322.     CALLDOS Close
  3323.     
  3324.     moveq #0,d0
  3325.     rts
  3326.  
  3327. readfail2 move.l file,d1
  3328.     CALLDOS Close
  3329. openfail2 moveq #1,d0
  3330.     rts
  3331.  
  3332.  
  3333. checksum move.l himem,a0
  3334. checksum2 move.w #67,d0
  3335.     clr.l d1
  3336. checkit add.l (a0)+,d1
  3337.     dbf d0,checkit
  3338.     rts
  3339.  
  3340.  
  3341. ** Load ILBM file **
  3342.  
  3343.  
  3344. loadILBM move.l a5,d1
  3345.      move.l #1005,d2
  3346.      CALLDOS Open
  3347.      tst.l d0
  3348.      beq goodbye
  3349.      move.l d0,file
  3350.  
  3351. * Read 8 bytes to check file is type ILBM
  3352.  
  3353. read move.l file,d1
  3354.     move.l #loadbuffer,d2
  3355.     move.l #12,d3
  3356.     CALLDOS Read
  3357.     cmp d3,d0
  3358.     bne lderror
  3359.  
  3360.     cmp.l #$494c424d,loadbuffer+8    * Test for letters ILBM
  3361.     bne notilbm
  3362.  
  3363. * Get chunk name/length
  3364.  
  3365. chunkloop
  3366.  
  3367.     move.l file,d1
  3368.     move.l #loadbuffer,d2
  3369.     move.l #8,d3
  3370.     CALLDOS Read
  3371.     cmp d3,d0
  3372.     bne lderror
  3373.     
  3374.     move.l loadbuffer+4,d0
  3375.     move.l #$10001,d1
  3376.     CALLEXEC AllocMem
  3377.     tst.l d0
  3378.     beq lderror
  3379.     move.l d0,buffer
  3380.  
  3381.     move.l file,d1
  3382.     move.l buffer,d2
  3383.     move.l loadbuffer+4,d3
  3384.     CALLDOS Read
  3385.     cmp d3,d0
  3386.     bne lderror
  3387.  
  3388.     cmp.l #$424d4844,loadbuffer        * "BMHD" ?
  3389.     bne nobitmaphead
  3390.     
  3391. * Get info about screen
  3392.  
  3393.     move.l buffer,a1
  3394.     cmp.w #640,(a1)
  3395.     bne lderror
  3396.     move.w (a1),iwidth
  3397.     move.w 2(a1),iheight
  3398.  
  3399.     move.b 8(a1),d3
  3400.     andi.w #$ff,d3
  3401.     move.w d3,idepth
  3402.     cmp.w #3,d3
  3403.     bne lderror
  3404.  
  3405.     move.b 10(a1),d0
  3406.     andi.w #$ff,d0
  3407.     move.w d0,icompr
  3408.  
  3409.     clr.l d0
  3410.     move.w iwidth,d0
  3411.     divu #8,d0
  3412.     move.w d0,irowbytes
  3413.  
  3414.     bra nextchunkloop
  3415.  
  3416. nobitmaphead cmpi.l #$434d4150,loadbuffer    * CMAP ?
  3417.     bne nocolormap
  3418.  
  3419.     move.l buffer,a1
  3420.     move.l #cols,a2    
  3421.  
  3422. * Build colour table
  3423.  
  3424.     move.w #7,d2
  3425.  
  3426. makecols clr.w d0
  3427.     move.b (a1)+,d0
  3428.     mulu.w #16,d0
  3429.     add.b (a1)+,d0
  3430.     clr.l d1
  3431.     move.b (a1)+,d1
  3432.     divu.w #16,d1
  3433.     add.b d1,d0
  3434.     move.w d0,(a2)+
  3435.     dbf d2,makecols
  3436.  
  3437.     bra nextchunkloop
  3438.     
  3439. nocolormap cmpi.l #$424f4459,loadbuffer        * "BODY" ?
  3440.     bne nextchunkloop
  3441.  
  3442.     cmp.w #1,icompr
  3443.     bhi lderror    * unknown compression algorithm
  3444.  
  3445. compression move.w #52,d4    
  3446.     move.l #down*80,d7
  3447.     move.l buffer,a3
  3448.  
  3449. loop7    move.l #bitmap2+8,a5
  3450.  
  3451.     move.w idepth,d6
  3452.     subq #1,d6    
  3453.  
  3454. loop3    move.l (a5)+,a4
  3455.     add.l d7,a4
  3456.     move.l a4,d5    
  3457.     
  3458.     tst.w icompr
  3459.     bne loop4
  3460.     move.w irowbytes,d0    * no compression
  3461.     subq #1,d0
  3462.     bra notsame
  3463.  
  3464. loop4    tst.b (a3)
  3465.     bmi compressed
  3466.     
  3467.     clr.w d0
  3468.     move.b (a3)+,d0
  3469. notsame    move.b (a3)+,d1
  3470.     or.b d1,(a4)+
  3471.     dbf d0,notsame
  3472.     bra okay
  3473.     
  3474. compressed clr.w d0
  3475.     move.b (a3)+,d0
  3476.     neg.b d0
  3477.     move.b (a3)+,d1
  3478. samebytes or.b d1,(a4)+
  3479.     dbf d0,samebytes
  3480.     
  3481. okay    move.l a4,d0
  3482.     sub.l d5,d0
  3483.     cmp.w irowbytes,d0
  3484.     blt loop4
  3485.     
  3486.     dbf d6,loop3
  3487.  
  3488.     add.w irowbytes,d7
  3489.     dbf d4,loop7
  3490.     
  3491.     bra goodload
  3492.  
  3493. nextchunkloop move.l buffer,a1
  3494.     move.l loadbuffer+4,d0
  3495.     CALLEXEC FreeMem
  3496.     
  3497.     bra chunkloop
  3498.  
  3499.  
  3500. goodload bsr freebuff
  3501.     move.l file,d1
  3502.     CALLDOS Close 
  3503.  
  3504.     move.b #-1,d0
  3505.  
  3506.     rts
  3507.  
  3508. notilbm
  3509.  
  3510. lderror bsr freebuff
  3511.  
  3512. closeILBM move.l file,d1
  3513.     CALLDOS Close
  3514.  
  3515. goodbye clr.l d0
  3516.     rts
  3517.  
  3518. freebuff move.l buffer,a1
  3519.     move.l loadbuffer+4,d0
  3520.     CALLEXEC FreeMem
  3521.     rts
  3522.  
  3523.  
  3524. ** Create the card table and set up screen for a new game **
  3525.  
  3526. setup    move.w #foundx1,d0
  3527.     move.w foundy,d1
  3528.     move.l cardmemory,a0
  3529.     add.l #46*8*3*53,a0    * Card outline
  3530.     bsr drawcard
  3531.     add.w #64,d0
  3532.     bsr drawcard
  3533.     move.w #foundx2,d0
  3534.     bsr drawcard
  3535.     add.w #64,d0
  3536.     bsr drawcard
  3537.     
  3538.     move.l #snd1,d0
  3539.     move.l #snd0,d1
  3540.     move.w #50,d2
  3541.     bsr play
  3542.  
  3543.     move.l tablememory,a0
  3544.     add.w #550,a0
  3545.     move.l a0,buffer
  3546.     move.w #52,d0
  3547. pack    move.b d0,(a0)+
  3548.     dbf d0,pack    * Create a new pack of cards
  3549.  
  3550.     move.w #300,d0    * Go through pack this many times
  3551.     move.l buffer,a0
  3552. shuffle1 move.w #51,d1    * Swapping each card
  3553. shuffle2 bsr random
  3554.     move.b randy+1,d2
  3555.     and.w #63,d2
  3556.     cmp.b #51,d2
  3557.     bls inlimits
  3558.     sub.b #30,d2
  3559. inlimits move.b 0(a0,d1),d3
  3560.     move.b 0(a0,d2),0(a0,d1)
  3561.     move.b d3,0(a0,d2)
  3562.     dbf d1,shuffle2
  3563.     dbf d0,shuffle1
  3564.  
  3565.     move.l #snd2,d0
  3566.     move.l #snd0+snd1,d1
  3567.     move.w #45,d2
  3568.     bsr play
  3569.  
  3570.  
  3571. ** Draw the plateau and initialize card table **
  3572.  
  3573.     move.l tablememory,a2
  3574.     move.l buffer,a1
  3575.     
  3576.     move.w topy,d1
  3577.     move.w #1,d2
  3578.     move.w #1,d3
  3579.     move.w #6,d6
  3580. card1    clr.w 6(a2)        * Status - Card face up    
  3581.     clr.w d4
  3582.     move.b (a1),d4
  3583.     subq #1,d4
  3584.     bra card3
  3585. card2    move.w #1,6(a2)        * Status - Card face down
  3586.     move.w #52,d4
  3587. card3    mulu.w #46*8*3,d4
  3588.     move.l cardmemory,a0
  3589.     add.l d4,a0
  3590.     move.w d2,d0
  3591.     mulu.w #64,d0
  3592.     add.w #37,d0
  3593.     move.w d0,(a2)        * Left x value
  3594.     move.w d1,2(a2)        * Top y value
  3595.     move.b d2,4(a2)        * Column card is in
  3596.     move.b d3,5(a2)        * Number in pile
  3597.     bsr suitin
  3598.  
  3599.     bsr flyback
  3600.     bsr flyback
  3601.     bsr drawcard
  3602.  
  3603.     add.w #10,a2
  3604.     addq #1,d2
  3605.     cmp.b #7,d2
  3606.     bls card2    * next in column
  3607.  
  3608.     sub.w d6,d2
  3609.     subq #1,d6
  3610.     add.w gapA,d1
  3611.     addq #1,d3
  3612.     cmp.b #7,d3
  3613.     bls card1    * next row
  3614.     
  3615. ** Store rest of cards in table as deck **
  3616.  
  3617.     move.w #24,d0
  3618. deck    move.w #deck1x,(a2)
  3619.     move.w foundy,2(a2)
  3620.     move.b #8,4(a2)
  3621.     move.b d0,5(a2)
  3622.     move.w #1,6(a2)
  3623.     bsr suitin
  3624.     add.w #10,a2
  3625.     dbf d0,deck
  3626.     clr.l -4(a2)    
  3627.  
  3628.     move.w #deck1x,d0
  3629.     move.w foundy,d1
  3630.     move.l cardmemory,a0
  3631.     add.l #46*8*3*52,a0
  3632.     bsr drawcard        * Draw deck
  3633.  
  3634. ** Do the 7 bases and 4 foundations
  3635.     
  3636.     move.w #101,d0
  3637.     move.w topy,d1
  3638.     move.b #1,d2
  3639. foundations move.w d0,(a2)
  3640.     move.w d1,2(a2)
  3641.     move.b d2,4(a2)
  3642.     clr.b 5(a2)
  3643.     clr.w 6(a2)
  3644.     clr.w 8(a2)
  3645.     add.w #64,d0
  3646.     add.w #10,a2
  3647.     add.b #1,d2
  3648.     cmp.b #8,d2
  3649.     bne notfounds1
  3650.     move.w #foundx1,d0
  3651.     move.w foundy,d1
  3652.     move.b #10,d2
  3653. notfounds1 cmp.b #12,d2
  3654.     bne notfounds2
  3655.     move.w #foundx2,d0
  3656. notfounds2 cmp.b #13,d2
  3657.     bls foundations
  3658.  
  3659.     rts
  3660.  
  3661.  
  3662.  
  3663. ** Put card & suit values into table from 1-52 value in d4 **
  3664.  
  3665. suitin    move.b (a1)+,d4
  3666.     clr.b d5
  3667. calcard cmp.b #13,d4
  3668.     bls gotit
  3669.     sub.b #13,d4
  3670.     addq #1,d5
  3671.     bra calcard
  3672. gotit    move.b d4,8(a2)        * Card value
  3673.     move.b d5,9(a2)        * Suit value
  3674.     rts
  3675.  
  3676.  
  3677.  
  3678. ***** Set the colours for this display *****
  3679.  
  3680. setcols    move.l #cols,a1
  3681. setbnw    move.l viewport,a0
  3682.     move.l #8,d0
  3683.     CALLGRAF LoadRGB4
  3684.  
  3685.     rts
  3686.  
  3687.  
  3688.  
  3689. ***** Clear the window *****
  3690.  
  3691. cls    move.l rastport,d7
  3692.     move.w #maxscrheight-1,d6
  3693.  
  3694. cls2    clr.w d0
  3695.     move.l d7,a1
  3696.     CALLGRAF SetDrMd    * Set JAM1
  3697.     move.l d7,a1
  3698.     move.w #1,d0
  3699.     CALLGRAF SetAPen
  3700.     move.l d7,a1
  3701.     clr.w d0
  3702.     move.w #8,d1
  3703.     CALLGRAF Move
  3704.     move.l d7,a1
  3705.     move.w #3,d0
  3706.     move.w #8,d1
  3707.     CALLGRAF Draw
  3708.  
  3709.     move.l d7,a1
  3710.     move.w #640,d0
  3711.     move.w #8,d1
  3712.     CALLGRAF Move
  3713.     move.l d7,a1
  3714.     move.w #564,d0
  3715.     move.w #8,d1
  3716.     CALLGRAF Draw
  3717.  
  3718.     move.l d7,a1
  3719.     clr.w d0
  3720.     CALLGRAF SetAPen
  3721.     
  3722.     clr.w d0
  3723.     move.w #9,d1
  3724.     move.w #640,d2
  3725.     move.w d6,d3
  3726.     move.l d7,a1
  3727.     CALLGRAF RectFill
  3728.  
  3729.     rts
  3730.  
  3731.  
  3732. ***** Clear status bits 1 to 3 in the card table *****
  3733.  
  3734. clear    move.l tablememory,a0
  3735.     move.w #63,d0
  3736. clearit    and.w #$fff1,6(a0)
  3737.     add.w #10,a0
  3738.     dbf d0,clearit
  3739.  
  3740.     rts
  3741.  
  3742.  
  3743.  
  3744. ***** Create the cards *****
  3745.  
  3746. createcards move.w #1,d7
  3747.     move.l cardmemory,a4
  3748. nextcard
  3749.     move.w #457,d0
  3750.     move.w #7,d1
  3751.     clr.w d2
  3752.     clr.w d3
  3753.     move.w #54,d4
  3754.     move.w #46,d5
  3755.  
  3756.     cmp.b #53,d7
  3757.     beq doback
  3758.     cmp.b #56,d7
  3759.     beq redeal
  3760.     cmp.b #54,d7
  3761.     bne doblank
  3762.     move.w #565,d0
  3763.     bsr block    * Draw card outline
  3764.     bra storecard
  3765. redeal    move.w #500,d0
  3766.     move.w #100,d1
  3767.     bsr block    * Blank out card
  3768.     move.w #457,d0
  3769.     move.w #10,d1
  3770.     move.w #23,d5
  3771.     move.w #8,d3
  3772.     bsr block    * Draw redeal sign
  3773.     bra storecard
  3774. doback    move.w #511,d0
  3775.     bsr block    * Draw card back
  3776.     bra storecard
  3777.  
  3778. doblank    bsr block    * Draw blank card
  3779.  
  3780.     move.w #33,d1
  3781.     move.w #11,d5
  3782.     move.w #3,d3
  3783.     bsr block    * Blank out redeal
  3784.     move.w #12,d5
  3785.     move.w #14,d3
  3786.     bsr block    * Blank out redeal
  3787.  
  3788.     cmp.b #55,d7
  3789.     beq storecard
  3790.  
  3791.     move.w d7,d6
  3792.     clr.w d5
  3793. findsuit cmp.w #13,d6
  3794.     bls gotsuit
  3795.     addq #1,d5
  3796.     sub.w #13,d6
  3797.     bra findsuit
  3798.  
  3799. gotsuit    move.w #416,d0
  3800.     move.w d5,suit+2
  3801.     mulu #18,d5
  3802.     add.w d5,d0
  3803.     move.w d0,suit    * Store pos of large suit symbol
  3804.     
  3805.     move.w d6,d0
  3806.     mulu.w #32,d0
  3807.     sub.w #32,d0
  3808.     btst.b #0,suit+3
  3809.     beq black
  3810.     add.w #16,d0
  3811. black    clr.w d1
  3812.     move.w #1,d2
  3813.     move.w #3,d3
  3814.     move.w #8,d4
  3815.     move.w #6,d5
  3816.     bsr block    * draw top left number
  3817.  
  3818.     add.w #8,d0
  3819.     move.w #45,d2
  3820.     move.w #37,d3
  3821.     bsr block    * draw bottom right number
  3822.  
  3823.     move.w suit+2,d0
  3824.     mulu #5,d0
  3825.     add.w #488,d0
  3826.     move.w #3,d2
  3827.     cmp.b #9,d6
  3828.     bls notpic1
  3829.     subq #1,d2
  3830. notpic1 move.w #10,d3
  3831.     move.w #5,d4
  3832.     move.w #3,d5
  3833.     bsr block    * draw top left symbol
  3834.  
  3835.     add.w #3,d1
  3836.     move.w #46,d2
  3837.     cmp.b #9,d6
  3838.     bls notpic2
  3839.     addq #1,d2
  3840. notpic2    move.w #33,d3
  3841.     bsr block    * draw bottom right symbol
  3842.  
  3843.     cmp.w #1,d7
  3844.     bne notacespade
  3845.     move.l #421,d0
  3846.     bra picture    * Draw ace of spades
  3847. notacespade cmp.w #10,d6
  3848.     bls notpiccy
  3849.     move.w d6,d0
  3850.     mulu.w #140,d0
  3851.     sub.w #1540,d0
  3852.     move.w suit+2,d5
  3853.     mulu.w #35,d5
  3854.     add.w d5,d0
  3855.     bra picture    * Draw picture card
  3856.  
  3857. notpiccy move.l #symbols,a5
  3858. findnum cmp.b #255,(a5)+
  3859.     bne findnum
  3860.     cmp.b (a5)+,d6
  3861.     bne findnum
  3862.  
  3863. drawsymbols move.w suit,d0
  3864.     clr.w d1
  3865.     clr.w d2
  3866.     move.b (a5)+,d2
  3867.     cmp.b #255,d2
  3868.     beq storecard
  3869.     clr.w d3
  3870.     move.b (a5)+,d3
  3871.     tst.b (a5)+
  3872.     beq pointsup
  3873.     add.w #9,d0
  3874. pointsup move.w #9,d4
  3875.     move.w #7,d5
  3876.     bsr block
  3877.     bra drawsymbols
  3878.  
  3879. picture    move.w #7,d1
  3880.     move.w #9,d2
  3881.     move.w #5,d3
  3882.     move.w #36,d4
  3883.     move.w #36,d5
  3884.     bsr block
  3885.  
  3886. ** Store the card drawn as 3 bitplanes of 8*46 bytes **
  3887.  
  3888. storecard move.l #bitmap2+8,a0
  3889.     move.w #2,d0
  3890. column    move.w #45,d1
  3891.     move.l (a0)+,a1
  3892.     add.w #140*80+4,a1    * Top left word of card
  3893. store    move.l (a1)+,(a4)+
  3894.     move.l (a1),(a4)+
  3895.     add.w #76,a1
  3896.     dbf d1,store
  3897.     dbf d0,column
  3898.  
  3899.     add.b #1,d7
  3900.     cmp.b #56,d7
  3901.     bls nextcard
  3902.  
  3903. ** Create the 2nd card mask (with righthand blank edge)
  3904.  
  3905.     move.l cardmask2,a0
  3906.     move.l cardmask,a1
  3907.     move.w #5,d0
  3908. threel    move.l (a1)+,(a0)+
  3909.     dbf d0,threel
  3910.  
  3911.     move.w #40,d0
  3912. middlebit move.l #$ffffffff,(a0)+
  3913.     move.l #$ffffff00,(a0)+
  3914.     dbf d0,middlebit
  3915.     move.l #$7fffffff,(a0)+
  3916.     move.l #$fffffe00,(a0)+
  3917.     move.l #$0fffffff,(a0)+
  3918.     move.l #$fffff000,(a0)+
  3919.  
  3920.     rts
  3921.  
  3922.  
  3923.  
  3924. ** Move a rectangle **
  3925.  
  3926. block    movem.l d0-d6/a0-a2,-(sp)
  3927.     add.l #down,d1
  3928.     add.l #cardx,d2
  3929.     add.l #cardy,d3
  3930.     move.w #$c0,d6
  3931.     move.l #bitmap2,a0
  3932.     move.l rastport2,a1
  3933.     CALLGRAF BltBitMapRastPort
  3934.     movem.l (sp)+,d0-d6/a0-a2
  3935.     rts
  3936.  
  3937.  
  3938.  
  3939. ***** Call drawcard routine for card from table in a1 *****
  3940.  
  3941. fromtable move.l d2,-(sp)
  3942.     move.w (a1),d0
  3943.     move.w 2(a1),d1
  3944.     clr.w d2
  3945.     btst.b #0,7(a1)
  3946.     beq faceisup
  3947.     move.b #52,d2
  3948.     bra mult    * card back
  3949. faceisup cmp.b #9,4(a1)
  3950.     bls notfdtions
  3951.     tst.b 5(a1)
  3952.     bne notfdtions
  3953.     move.b #53,d2
  3954.     bra mult    * card outline
  3955. notfdtions cmp.b #8,4(a1)
  3956.     bne notdecks
  3957.     tst.b 5(a1)
  3958.     bne notdecks
  3959.     move.b #55,d2
  3960.     bra mult
  3961. notdecks move.b 9(a1),d2
  3962.     mulu.w #13,d2
  3963.     add.b 8(a1),d2
  3964.     subq #1,d2
  3965. mult    mulu.w #8*46*3,d2
  3966.     move.l cardmemory,a0
  3967.     add.l d2,a0
  3968.     move.l (sp)+,d2
  3969.     rts
  3970.  
  3971.  
  3972.  
  3973. ***** Draw a card at x=d0,y=d1,a0=first word *****
  3974.  
  3975. drawcard movem.l d0-d7/a0-a7,-(sp) 
  3976.     bsr setupdraw
  3977.     move.w #2,d0    
  3978.     bsr drawplanes
  3979.     movem.l (sp)+,d0-d7/a0-a7
  3980.     rts
  3981.  
  3982.  
  3983.  
  3984. ***** Same as drawcard routine but on bitmap2 *****
  3985.  
  3986. drawcard2 movem.l d0-d7/a0-a7,-(sp) 
  3987.     bsr setupdraw
  3988.     move.w #2,d0
  3989.     move.l #bitmap2+8,a1    
  3990.     bsr drawplanes
  3991.     movem.l (sp)+,d0-d7/a0-a7
  3992.     rts
  3993.  
  3994.  
  3995. ** This routine sets up registers for drawcard **
  3996.  
  3997. setupdraw bsr ownblitter
  3998.     move.l #$dff000,a5
  3999.  
  4000.     mulu.w #80,d1
  4001.     move.w d0,d2
  4002.     lsr.w #3,d2
  4003.     bclr #0,d2
  4004.     add.w d2,d1    * d1=offset into bitplane
  4005.     lsl.w #3,d2
  4006.     sub.w d2,d0    * d0=pixels to shift right
  4007.     lsl.w #4,d0
  4008.     lsl.w #8,d0
  4009.     move.w d0,$042(a5)    * Control 1
  4010.  
  4011.     add.w #$0fca,d0    * use A,B,C & D    
  4012.     move.w d0,$040(a5)    * Control 0
  4013.         
  4014.     move.l bitmap,a1
  4015.     add.w #8,a1
  4016.     move.w #70,$060(a5)    * C modulo
  4017.     move.w #70,$066(a5)    * D modulo
  4018.     move.l #$fffefffe,$062(a5)    * A & B modulos
  4019.     move.l #$ffff0000,$044(a5)    * Masks
  4020.  
  4021.     rts
  4022.  
  4023. ** This routine is part of drawcard **
  4024.  
  4025. drawplanes move.l cardmask2,$050(a5) * Source A (mask)
  4026.     move.l a0,$04c(a5)    * Source B
  4027.     add.w #46*8,a0
  4028.     move.l (a1)+,a2
  4029.     add.w d1,a2
  4030.     move.l a2,$048(a5)    * Source C
  4031.     move.l a2,$054(a5)    * Destination
  4032.     
  4033.     move.w #46*64+5,$058(a5) * Blit a bitplane
  4034.     bsr waitblit
  4035.     dbf d0,drawplanes
  4036.  
  4037.     CALLGRAF DisownBlitter
  4038.     
  4039.     rts
  4040.  
  4041.  
  4042.  
  4043. ***** I want to use the blitter *****
  4044.  
  4045. ownblitter CALLGRAF OwnBlitter
  4046.     CALLGRAF WaitBlit
  4047.     move.w #$8440,$dff096    * Blitter DMA enable
  4048.     rts
  4049.  
  4050.  
  4051. ***** Wait for the blitter to complete operation *****
  4052.  
  4053. waitblit btst.b #6,$dff002
  4054.     bne waitblit
  4055.     rts
  4056.  
  4057.  
  4058. ***** Wait for frame flyback *****
  4059.  
  4060. flyback    move.w #$8420,$dff09a
  4061.     move.w #$0020,$dff09c
  4062. waitfly    btst.b #5,$dff01f
  4063.     beq waitfly
  4064.     rts
  4065.  
  4066. ***** Uses raster beam position to update random number in randy *****
  4067.  
  4068. random    move.w d0,-(sp)
  4069.     move.w randy,d0
  4070.     add.w d0,d0
  4071.     add.w d0,d0
  4072.     add.w d0,d0
  4073.     add.w d0,d0
  4074.     add.w d0,d0
  4075.     add.w d0,d0
  4076.     add.w d0,d0
  4077.     add.w d0,d0
  4078.     add.w randy,d0
  4079.     move.w d0,randy
  4080.     move.w $dff006,d0
  4081.     lsr.w #1,d0
  4082.     sub.w d0,randy
  4083.     move.w (sp)+,d0
  4084.     rts
  4085.  
  4086.  
  4087.  
  4088. ***** First convert score into ASCII then print it *****
  4089.  
  4090. printscore move.w score,d0
  4091.     move.w d0,oldscore    
  4092.     bsr donumber
  4093.     move.b #32,(a1)+
  4094.     move.b #32,(a1)+
  4095.     move.b #32,(a1)+
  4096.     move.b #32,(a1)+
  4097.     move.b #32,(a1)+
  4098.     clr.b (a1)
  4099.  
  4100.     move.l rastport,a0
  4101.     move.l #scoreitext,a1
  4102.     clr.w d0
  4103.     clr.w d1
  4104.     CALLINT PrintIText
  4105.  
  4106.     rts
  4107.  
  4108. donumber move.l #storage,a1
  4109. donumber2 move.l #multiples,a0
  4110.     clr.b d4
  4111.     tst.w d0
  4112.     bpl nextdigit
  4113.     move.b #45,(a1)+
  4114.     neg.w d0
  4115.  
  4116. nextdigit move.w (a0)+,d1
  4117.     beq completed
  4118.     clr.b d2
  4119.     
  4120. notfounddigit cmp.w d0,d1
  4121.     bhi founddigit
  4122.     sub.w d1,d0
  4123.     addq #1,d2
  4124.     bra notfounddigit
  4125.     
  4126. founddigit tst.b d2
  4127.     bne notnort
  4128.     tst.b d4
  4129.     beq nextdigit
  4130. notnort    add.b #48,d2
  4131.     addq #1,d4
  4132.     move.b d2,(a1)+
  4133.     bra nextdigit
  4134.     
  4135. completed add.b #48,d0
  4136.     move.b d0,(a1)+
  4137.     
  4138.     rts
  4139.  
  4140.  
  4141.  
  4142. ******************************
  4143.  
  4144. foundy    dc.w 0
  4145. gapA    dc.w 0
  4146. gapB    dc.w 0
  4147. topy    dc.w 0
  4148. scrheight dc.w 0
  4149. htop    dc.w 0
  4150. hhite    dc.w 0
  4151. white    dc.w 0
  4152. name1pos dc.w 0
  4153. name2down dc.w 0
  4154.  
  4155. stack    dc.l 0
  4156. suit    dc.l 0
  4157. file     dc.l 0
  4158. randy    dc.w 0
  4159. window    dc.l 0
  4160. bitmap    dc.l 0
  4161. buffer    dc.l 0
  4162. score    dc.w 0
  4163. oldscore dc.w 0
  4164. _WBenchMsg dc.l 0
  4165. viewport dc.l 0
  4166. rastport dc.l 0
  4167. rastport2 dc.l 0
  4168. cardmask dc.l 0
  4169. cardmask2 dc.l 0
  4170. himem dc.l 0
  4171. soundmem dc.l 0
  4172. movememory dc.l 0
  4173. numcards dc.w 0
  4174. cardmemory dc.l 0
  4175. firstpass dc.w 0
  4176. oldx dc.w 0
  4177. oldy dc.w 0
  4178. newx dc.w 0
  4179. newy dc.w 0
  4180. movex dc.w 0
  4181. movey dc.w 0
  4182. movesize dc.w 0
  4183. movecard dc.l 0
  4184. moveshift dc.w 0
  4185. moveheight dc.w 0
  4186. oldoffset dc.w 0
  4187. moveoffset dc.w 0
  4188. yposition dc.w 0
  4189. games    dc.w 0
  4190. tablememory dc.l 0
  4191. properx dc.w 0
  4192. hilitecard dc.l 0
  4193. hiliteoffset dc.w 0
  4194. wherefrom dc.l 0
  4195. whereto    dc.l 0
  4196. userport dc.l 0
  4197. firsttime dc.l 0
  4198. seconds dc.l 0
  4199. oldsecs dc.l 0
  4200. micros dc.l 0
  4201. oldstatus dc.w 0
  4202.  
  4203. iwidth dc.w 0
  4204. iheight dc.w 0
  4205. idepth dc.w 0
  4206. icompr dc.w 0
  4207. irowbytes dc.w 0
  4208.  
  4209. _DOSBase dc.l 0
  4210. _GfxBase dc.l 0
  4211. _IntuitionBase dc.l 0
  4212.  
  4213. bitmap2 ds.l 10
  4214.  
  4215. lock1    dc.l 0
  4216. lock2    dc.l 0
  4217. lock3    dc.l 0
  4218.  
  4219.  
  4220. mgadg    dc.l 0
  4221.     dc.w mleft+(mwidth-320)/2,mtop+67,320,8
  4222.     dc.w 0,1,4
  4223.     dc.l mbox4,0,0,0,infostring
  4224.     dc.w 1001,0,0
  4225.  
  4226. mgadg2    dc.l mgadg3
  4227.     dc.w mleft+40,mtop+115,110,13
  4228.     dc.w 0,1,1
  4229.     dc.l mbox5,0,mtext9,0,0
  4230. mtype    dc.w 1002,0,0
  4231.  
  4232. mgadg3    dc.l 0
  4233.     dc.w mleft+mwidth-150,mtop+115,110,13
  4234.     dc.w 0,1,1
  4235.     dc.l mbox5,0,mtext10,0,0
  4236. mtype2    dc.w 1003,0,0
  4237.  
  4238.  
  4239. infostring dc.l mergename,0
  4240.     dc.w 12,50,0,0,12,32,0,0
  4241.     dc.l 0,0,0
  4242.  
  4243. mbox1    dc.w 0,0
  4244.     dc.b 0,0,0,10
  4245.     dc.l mboxA,mbox2
  4246.  
  4247. mbox2    dc.w 4,2
  4248.     dc.b 7,0,0,10
  4249.     dc.l mboxB,0
  4250.  
  4251. mbox3    dc.w 15,40
  4252.     dc.b 7,0,0,12
  4253.     dc.l mboxC,0
  4254.  
  4255. mbox4    dc.w 0,-1
  4256.     dc.b 0,0,0,2
  4257.     dc.l mboxD,0
  4258.  
  4259. mbox5    dc.w 0,0
  4260.     dc.b 4,0,0,10
  4261.     dc.l mboxE,mbox6
  4262.  
  4263. mbox6    dc.w -4,-2
  4264.     dc.b 7,0,0,10
  4265.     dc.l mboxF,0
  4266.  
  4267. mboxA    dc.w 0,0,mwidth-1,0,mwidth-1,mhite-1
  4268.     dc.w mwidth-2,mhite-1,mwidth-2,0,mwidth-2,mhite-1
  4269.     dc.w 0,mhite-1,0,0,1,0,1,mhite-1
  4270.  
  4271. mboxB    dc.w 0,0,mwidth-9,0,mwidth-9,mhite-5
  4272.     dc.w mwidth-10,mhite-5,mwidth-10,0,mwidth-10,mhite-5
  4273.     dc.w 0,mhite-5,0,0,1,0,1,mhite-5
  4274.  
  4275. mboxC    dc.w 0,0,mwidth-31,0,mwidth-31,36
  4276.     dc.w mwidth-32,36,mwidth-32,0,mwidth-32,36
  4277.     dc.w 0,36,0,0,1,0,1,36,1,24,mwidth-32,24
  4278.  
  4279. mboxD    dc.w 0,0,320,0
  4280.  
  4281. mboxE    dc.w 0,0,109,0,109,1,0,1,0,2,109,2,109,11,0,11,0,12,109,12
  4282. mboxF    dc.w 0,0,117,0,117,16,116,16,116,0,116,16,0,16,0,0,1,0,1,16
  4283.  
  4284.  
  4285.     even
  4286.  
  4287.  
  4288. mtext1    dc.b 2,0,0,0
  4289.     dc.w (mwidth-206)/2,21
  4290.     dc.l font2,mtextA,mtext2
  4291.  
  4292. mtext2    dc.b 4,0,0,0
  4293.     dc.w (mwidth-210)/2,20
  4294.     dc.l font2,mtextA,mtext8
  4295.  
  4296. mtext3    dc.b 0,0,1,0
  4297.     dc.w (mwidth-320)/2,42
  4298.     dc.l font2,mtextC,mtext4
  4299.  
  4300. mtext4    dc.b 0,0,1,0
  4301.     dc.w (mwidth-320)/2,54
  4302.     dc.l font2,mtextC,mtext5
  4303.  
  4304. mtext5    dc.b 7,0,1,0
  4305.     dc.w (mwidth-320)/2,49
  4306.     dc.l font2,mtextB,mtext6
  4307.  
  4308. mtext6    dc.b 1,0,0,0
  4309.     dc.w (mwidth-324)/2,48
  4310.     dc.l font2,mtextB,0
  4311.  
  4312. mtext7    dc.b 7,1,1,0
  4313.     dc.w (mwidth-200)/2,86
  4314.     dc.l font2
  4315. messg    dc.l 0,0
  4316.  
  4317. mtext8    dc.b 7,0,0,0
  4318.     dc.w (mwidth-320)/2,49
  4319.     dc.l font2,mtextH,0
  4320.  
  4321. mtext9    dc.b 1,4,1,0
  4322.     dc.w 0,3
  4323.     dc.l font2
  4324. gadtext    dc.l 0,0
  4325.  
  4326. mtext10    dc.b 1,4,1,0
  4327.     dc.w 0,3
  4328.     dc.l font2
  4329. gadtext2 dc.l 0,0
  4330.  
  4331. mtext11    dc.b 7,0,0,0
  4332.     dc.w (mwidth-320)/2,65
  4333.     dc.l font2,mtextP,0
  4334.  
  4335. mtext12    dc.b 7,1,1,0
  4336.     dc.w (mwidth-210)/2,45
  4337.     dc.l font2,mtextQ,0
  4338.  
  4339.  
  4340. newscreen dc.w 0,0,640,maxscrheight,3
  4341.     dc.b 7,1
  4342.     dc.w $8000        * V_HIRES
  4343.     dc.w $000f        * CUSTOMSCREEN
  4344.     dc.l font,0,0,0
  4345.  
  4346. font    dc.l fontype
  4347.     dc.w 8        * TOPAZ_EIGHTY
  4348.     dc.b 0,1    * FS_NORMAL,FPF_ROMFONT
  4349.  
  4350. font2    dc.l fontype
  4351.     dc.w 9        * TOPAZ_SIXTY
  4352.     dc.b 0,1    * FS_NORMAL,FPF_ROMFONT
  4353.  
  4354. newwindow dc.w 0,0,640,maxscrheight
  4355.     dc.b 7,1
  4356.     dc.l $0140    * MENUPICK+GADGETUP
  4357.     dc.l $1800    * ACTIVATE+BORDERLESS
  4358.     dc.l 0,0,wndtitle
  4359. screen    dc.l 0,0
  4360.     dc.w 0,0,0,0,$000f    * CUSTOMSCREEN
  4361.  
  4362.     even
  4363.  
  4364. scoreitext dc.b 1,0,1,0
  4365.     dc.w 280
  4366. scorepos dc.w 68
  4367.     dc.l font,scoretext,0
  4368.  
  4369. cols    ds.w 8
  4370. cols2    dc.w $000,$fff,$ccc,$222,$888,$777,$aaa,$000
  4371. pointpens dc.b 0,0,0,8,8,8,31,31,31
  4372.  
  4373. symbols    dc.b 255,1,23,19,0
  4374.     dc.b 255,2,23,7,0,23,33,1
  4375.     dc.b 255,3,23,6,0,23,20,0,23,34,1
  4376.     dc.b 255,4,11,5,0,34,5,0,11,33,1,34,33,1
  4377.     dc.b 255,5,11,6,0,34,6,0,11,34,1,34,34,1,23,20,0
  4378.     dc.b 255,6,11,6,0,34,6,0,11,34,1,34,34,1,11,20,0,34,20,0
  4379.     dc.b 255,7,11,6,0,34,6,0,11,34,1,34,34,1,11,20,0,34,20,0,23,13,0
  4380.     dc.b 255,8,11,6,0,34,6,0,11,34,1,34,34,1,11,20,0
  4381.     dc.b 34,20,0,23,13,0,23,27,1
  4382.     dc.b 255,9,11,6,0,34,6,0,11,16,0,34,16,0,23,20,0
  4383.     dc.b 11,25,1,34,25,1,11,35,1,34,35,1
  4384.     dc.b 255,10,11,6,0,34,6,0,23,12,0,11,16,0,34,16,0
  4385.     dc.b 11,25,1,34,25,1,23,29,1,11,35,1,34,35,1,255
  4386.     
  4387.     Even
  4388.  
  4389. multiples dc.w 10000
  4390.     dc.w 1000
  4391.     dc.w 100
  4392.     dc.w 10
  4393.     dc.w 0
  4394.  
  4395. MENUENABLED    equ $0001
  4396. MIDRAWN        equ $0100
  4397. CHECKIT        equ $0001
  4398. ITEMTEXT    equ $0002
  4399. COMMSEQ        equ $0004
  4400. MENUTOGGLE    equ $0008
  4401. ITEMENABLED    equ $0010
  4402. HIGHFLAGS    equ $00C0
  4403. HIGHIMAGE    equ $0000
  4404. HIGHCOMP    equ $0040
  4405. HIGHBOX        equ $0080
  4406. HIGHNONE    equ $00C0
  4407. CHECKED        equ $0100
  4408.  
  4409. klondike dc.l game
  4410.     dc.w 8,0,78,0,MENUENABLED
  4411.     dc.l name1
  4412.     dc.l klondike1
  4413.     dc.w 0,0,0,0
  4414.  
  4415. game    dc.l options
  4416.     dc.w 104,0,46,0,MENUENABLED
  4417.     dc.l name2
  4418.     dc.l game1
  4419.     dc.w 0,0,0,0
  4420.  
  4421. options    dc.l help
  4422.     dc.w 168,0,70,0,MENUENABLED
  4423.     dc.l name3
  4424.     dc.l options1
  4425.     dc.w 0,0,0,0
  4426.  
  4427. help    dc.l 0
  4428.     dc.w 256,0,54,0,MENUENABLED
  4429.     dc.l name4
  4430.     dc.l help1
  4431.     dc.w 0,0,0,0
  4432.  
  4433.  
  4434. klondike1 dc.l klondike2
  4435.     dc.w 0,0,74,8,ITEMTEXT+ITEMENABLED+HIGHCOMP
  4436.     dc.l 0,intext1,0
  4437.     dc.b 0,0
  4438.     dc.l 0
  4439.     dc.w 0
  4440.  
  4441. klondike2 dc.l klondike3
  4442.     dc.w 0,10,74,8,ITEMTEXT+ITEMENABLED+HIGHCOMP
  4443.     dc.l 0,intext1b,0
  4444.     dc.b 0,0
  4445.     dc.l 0
  4446.     dc.w 0
  4447.  
  4448. klondike3 dc.l klondike4
  4449.     dc.w 0,20,74,8,ITEMTEXT+ITEMENABLED+HIGHCOMP
  4450.     dc.l 0,intext1c,0
  4451.     dc.b 0,0
  4452.     dc.l 0
  4453.     dc.w 0
  4454.  
  4455. klondike4 dc.l 0
  4456.     dc.w 0,30,74,8,ITEMTEXT+ITEMENABLED+HIGHCOMP
  4457.     dc.l 0,intext2,0
  4458.     dc.b 0,0
  4459.     dc.l 0
  4460.     dc.w 0
  4461.  
  4462. game1    dc.l game2
  4463.     dc.w 0,0,80,8,ITEMTEXT+ITEMENABLED+HIGHCOMP
  4464.     dc.l 0,intext3,0
  4465.     dc.b 0,0
  4466.     dc.l 0
  4467.     dc.w 0
  4468.  
  4469. game2    dc.l 0
  4470.     dc.w 0,10,80,8,ITEMTEXT+HIGHCOMP
  4471.     dc.l 0,intext4,0
  4472.     dc.b 0,0
  4473.     dc.l 0
  4474.     dc.w 0
  4475.  
  4476. options1 dc.l options2
  4477.     dc.w 0,0,152,8
  4478. opt1    dc.w 0
  4479.     dc.l 2,intext6e,0
  4480.     dc.b 0,0
  4481.     dc.l 0
  4482.     dc.w 0
  4483.  
  4484. options2 dc.l options3
  4485.     dc.w 0,10,152,8
  4486. opt2    dc.w 0
  4487.     dc.l 1,intext6f,0
  4488.     dc.b 0,0
  4489.     dc.l 0
  4490.     dc.w 0
  4491.  
  4492. options3 dc.l options4
  4493.     dc.w 0,20,152,8
  4494. opt3    dc.w 0
  4495.     dc.l 8,intext5,0
  4496.     dc.b 0,0
  4497.     dc.l 0
  4498.     dc.w 0
  4499.  
  4500. options4 dc.l options5
  4501.     dc.w 0,30,152,8
  4502. opt4    dc.w 0
  4503.     dc.l 4,intext6,0
  4504.     dc.b 0,0
  4505.     dc.l 0
  4506.     dc.w 0
  4507.  
  4508. options5 dc.l options6
  4509.     dc.w 0,40,152,8,ITEMTEXT+ITEMENABLED+HIGHCOMP
  4510.     dc.l 0,intext6g,0
  4511.     dc.b 0,0
  4512. firstsub1 dc.l 0
  4513.     dc.w 0
  4514.  
  4515. options6 dc.l options7
  4516.     dc.w 0,50,152,8,ITEMTEXT+ITEMENABLED+HIGHCOMP
  4517.     dc.l 0,intext6h,0
  4518.     dc.b 0,0
  4519. firstsub2 dc.l 0
  4520.     dc.w 0
  4521.  
  4522. options7 dc.l options8
  4523.     dc.w 0,60,152,8,ITEMTEXT+ITEMENABLED+HIGHCOMP
  4524.     dc.l 0,intext6i,0
  4525.     dc.b 0,0
  4526. firstsub3 dc.l 0
  4527.     dc.w 0
  4528.  
  4529.  
  4530. options8 dc.l options9
  4531.     dc.w 0,70,152,8,ITEMTEXT+ITEMENABLED+HIGHCOMP
  4532.     dc.l 0,intext6d,0
  4533.     dc.b 0,0
  4534.     dc.l 0
  4535.     dc.w 0
  4536.  
  4537. options9 dc.l 0
  4538.     dc.w 0,80,152,8,ITEMTEXT+ITEMENABLED+HIGHCOMP
  4539.     dc.l 0,intext6b,0
  4540.     dc.b 0,0
  4541.     dc.l subitem1
  4542.     dc.w 0
  4543.  
  4544. subitem1 dc.l 0
  4545.     dc.w 148,5,72,8,ITEMTEXT+ITEMENABLED+HIGHCOMP
  4546.     dc.l 0,intext6c,0
  4547.     dc.b 0,0
  4548.     dc.l 0
  4549.     dc.w 0
  4550.  
  4551. help1    dc.l help2
  4552.     dc.w 0,0,144,8,ITEMTEXT+ITEMENABLED+HIGHCOMP
  4553.     dc.l 0,intext7,0
  4554.     dc.b 0,0
  4555.     dc.l 0
  4556.     dc.w 0
  4557.  
  4558. help2    dc.l help3
  4559.     dc.w 0,10,144,8,ITEMTEXT+ITEMENABLED+HIGHCOMP
  4560.     dc.l 0,intext8,0
  4561.     dc.b 0,0
  4562.     dc.l 0
  4563.     dc.w 0
  4564.  
  4565. help3    dc.l help4
  4566.     dc.w 0,20,144,8,ITEMTEXT+ITEMENABLED+HIGHCOMP
  4567.     dc.l 0,intext9,0
  4568.     dc.b 0,0
  4569.     dc.l 0
  4570.     dc.w 0
  4571.  
  4572. help4    dc.l 0
  4573.     dc.w 0,30,144,8,ITEMTEXT+ITEMENABLED+HIGHCOMP
  4574.     dc.l 0,intext10,0
  4575.     dc.b 0,0
  4576.     dc.l 0
  4577.     dc.w 0
  4578.  
  4579.     even
  4580.  
  4581. intext1 dc.b 7,0,0,0
  4582.     dc.w 8,0
  4583.     dc.l 0,text1,0
  4584.  
  4585. intext1b dc.b 7,0,0,0
  4586.     dc.w 8,0
  4587.     dc.l 0,text1b,0
  4588.  
  4589. intext1c dc.b 7,0,0,0
  4590.     dc.w 8,0
  4591.     dc.l 0,text1c,0
  4592.  
  4593. intext2    dc.b 7,0,0,0
  4594.     dc.w 8,0
  4595.     dc.l 0,text2,0
  4596.  
  4597. intext3    dc.b 7,0,0,0
  4598.     dc.w 8,0
  4599.     dc.l 0,text3,0
  4600.  
  4601. intext4    dc.b 7,0,0,0
  4602.     dc.w 8,0
  4603.     dc.l 0,text4,0
  4604.  
  4605. intext5    dc.b 7,0,0,0
  4606.     dc.w 8,0
  4607.     dc.l 0,text5,0
  4608.  
  4609. intext6    dc.b 7,0,0,0
  4610.     dc.w 8,0
  4611.     dc.l 0,text6,0
  4612.  
  4613. intext6b dc.b 7,0,0,0
  4614.     dc.w 8,0
  4615.     dc.l 0,text6b,0
  4616.  
  4617. intext6c dc.b 7,0,0,0
  4618.     dc.w 5,0
  4619.     dc.l 0,text6c,0
  4620.  
  4621. intext6d dc.b 7,0,0,0
  4622.     dc.w 8,0
  4623.     dc.l 0,text6d,0
  4624.  
  4625. intext6e dc.b 7,0,0,0
  4626.     dc.w 8,0
  4627.     dc.l 0,text6e,0
  4628.  
  4629. intext6f dc.b 7,0,0,0
  4630.     dc.w 8,0
  4631.     dc.l 0,text6f,0
  4632.  
  4633. intext6g dc.b 7,0,0,0
  4634.     dc.w 8,0
  4635.     dc.l 0,text6g,0
  4636.  
  4637. intext6h dc.b 7,0,0,0
  4638.     dc.w 8,0
  4639.     dc.l 0,text6h,0
  4640.  
  4641. intext6i dc.b 7,0,0,0
  4642.     dc.w 8,0
  4643.     dc.l 0,text6i,0
  4644.  
  4645. intext7    dc.b 7,0,0,0
  4646.     dc.w 8,0
  4647.     dc.l 0,text7,0
  4648.  
  4649. intext8    dc.b 7,0,0,0
  4650.     dc.w 8,0
  4651.     dc.l 0,text8,0
  4652.  
  4653. intext9    dc.b 7,0,0,0
  4654.     dc.w 8,0
  4655.     dc.l 0,text9,0
  4656.  
  4657. intext10 dc.b 7,0,0,0
  4658.     dc.w 8,0
  4659.     dc.l 0,text9b,0
  4660.  
  4661. titler    dc.b 7,0,0,0
  4662.     dc.w 27
  4663. y1    dc.w 12
  4664.     dc.l font2,text10,titler2
  4665.  
  4666. titler2    dc.b 1,0,0,0
  4667.     dc.w 25
  4668. y2    dc.w 11
  4669.     dc.l font2,text10,lastscore
  4670.  
  4671. lastscore dc.b 7,0,0,0
  4672.     dc.w 0
  4673. y3    dc.w 190
  4674.     dc.l font2,lastscr,lastscore2
  4675.  
  4676. lastscore2 dc.b 1,0,0,0
  4677.     dc.w 0
  4678. y4    dc.w 189
  4679.     dc.l font2,lastscr,gamesdone
  4680.  
  4681. gamesdone dc.b 7,0,0,0
  4682.     dc.w 0
  4683. y5    dc.w 201
  4684.     dc.l font2,gamespld,gamesdone2
  4685.  
  4686. gamesdone2 dc.b 1,0,0,0
  4687.     dc.w 0
  4688. y6    dc.w 200
  4689.     dc.l font2,gamespld,0
  4690.  
  4691.  
  4692. textspace dc.b 0,0,1,0
  4693.     dc.w 80,0
  4694.     dc.l 0,spc,0
  4695.  
  4696. spc    dc.b 32,0
  4697.  
  4698. name    dc.b 4,0,0,0
  4699.     dc.w hleft,1
  4700. fontys    dc.l 0
  4701. namepos    dc.l 0
  4702. nextname dc.l namea
  4703.  
  4704. namea    dc.b 2,0,0,0
  4705.     dc.w hleft-2,0
  4706.     dc.l font2
  4707. namepos2 dc.l 0,0
  4708.  
  4709.  
  4710. border    dc.w 2,1
  4711.     dc.b 1,0,0,10
  4712. boxloc    dc.l boxP,0
  4713.  
  4714. borderA    dc.w 2,1
  4715.     dc.b 1,0,0,10
  4716. boxloc2    dc.l boxP2,0
  4717.  
  4718.  
  4719. boxP2    dc.w 0,0,wwidth-5,0,wwidth-5,whiteP-2
  4720.     dc.w wwidth-6,whiteP-2,wwidth-6,0,wwidth-6,whiteP-2
  4721.     dc.w 0,whiteP-2,0,0,1,0,1,whiteP-2
  4722.  
  4723. boxN2    dc.w 0,0,wwidth-5,0,wwidth-5,whiteN-2
  4724.     dc.w wwidth-6,whiteN-2,wwidth-6,0,wwidth-6,whiteN-2
  4725.     dc.w 0,whiteN-2,0,0,1,0,1,whiteN-2
  4726.  
  4727.  
  4728. boxP    dc.w 0,0,hwidth-5,0,hwidth-5,hhiteP-3
  4729.     dc.w hwidth-6,hhiteP-3,hwidth-6,0,hwidth-6,hhiteP-3
  4730.     dc.w 0,hhiteP-3,0,0,1,0,1,hhiteP-3
  4731.  
  4732. boxN    dc.w 0,0,hwidth-5,0,hwidth-5,hhiteN-3
  4733.     dc.w hwidth-6,hhiteN-3,hwidth-6,0,hwidth-6,hhiteN-3
  4734.     dc.w 0,hhiteN-3,0,0,1,0,1,hhiteN-3
  4735.  
  4736.  
  4737. box2    dc.w 0,0
  4738.     dc.b 0,0,0,10
  4739.     dc.l box4,box3
  4740.  
  4741. box3    dc.w 4,2
  4742.     dc.b 7,0,0,10
  4743.     dc.l box5,0
  4744.  
  4745. boxA    dc.w 2,1
  4746.     dc.b 7,0,0,10
  4747.     dc.l box8,0
  4748.  
  4749.  
  4750. gadgebox dc.w -4,-2
  4751.     dc.b 7,0,0,10
  4752.     dc.l box6,gadgebox2
  4753.  
  4754. gadgebox2 dc.w -2,-1
  4755.     dc.b 0,0,0,10
  4756.     dc.l box7,0
  4757.  
  4758. boxit    dc.w -2,-1
  4759.     dc.b 1,0,0,10
  4760.     dc.l boxX,0
  4761.  
  4762.  
  4763. box6    dc.w 0,0,95,0,95,11,94,11,94,0,94,11,0,11,0,0,1,0,1,11
  4764. box7    dc.w 0,0,91,0,91,9,90,9,90,0,90,9,0,9,0,0,1,0,1,9
  4765. boxX    dc.w 0,0,83,0,83,10,82,10,82,0,82,10,0,10,0,0,1,0,1,10
  4766.  
  4767. box4    dc.w 0,0,rwidth-1,0,rwidth-1,rhite-1
  4768.     dc.w rwidth-2,rhite-1,rwidth-2,0,rwidth-2,rhite-1
  4769.     dc.w 0,rhite-1,0,0,1,0,1,rhite-1
  4770.  
  4771. box5    dc.w 0,0,rwidth-9,0,rwidth-9,rhite-5
  4772.     dc.w rwidth-10,rhite-5,rwidth-10,0,rwidth-10,rhite-5
  4773.     dc.w 0,rhite-5,0,0,1,0,1,rhite-5
  4774.  
  4775. box8    dc.w 0,0,fwidth-5,0,fwidth-5,fhite-3
  4776.     dc.w fwidth-6,fhite-3,fwidth-6,0,fwidth-6,fhite-3
  4777.     dc.w 0,fhite-3,0,0,1,0,1,fhite-3
  4778.  
  4779.  
  4780.     even
  4781.  
  4782. reqtext1 dc.b 7,0,0,0
  4783.     dc.w 20,10
  4784.     dc.l font2,text11,reqtext2
  4785.  
  4786. reqtext2 dc.b 7,0,0,0
  4787.     dc.w 20,30
  4788.     dc.l font2,text12,0
  4789.  
  4790. welldone1 dc.b 3,0,0,0
  4791.     dc.w 46,10
  4792.     dc.l font2,text13,welldone2
  4793.  
  4794. welldone2 dc.b 7,0,0,0
  4795.     dc.w 0,29
  4796.     dc.l font2,text14,welldone3
  4797.  
  4798. welldone3 dc.b 7,0,0,0
  4799.     dc.w 0,45
  4800.     dc.l font2,text15,0
  4801.  
  4802. more    dc.b 1,4,1,0
  4803.     dc.w 0,0
  4804.     dc.l font2,text16,0
  4805.  
  4806. cancel    dc.b 1,4,1,0
  4807.     dc.w 0,0
  4808.     dc.l font2,text17,0
  4809.  
  4810.  
  4811. lineoftext dc.b 1,0,0,0
  4812.     dc.w 0,0
  4813.     dc.l 0,0,0
  4814.  
  4815.  
  4816. textgadget dc.l 0
  4817.     dc.w 81,50,96,8
  4818. ongadge    dc.w 0,$0005,$1004    * STRGADGET
  4819.     dc.l gadgebox,0,textspace,0,stringinfo
  4820.     dc.w 0,0,0
  4821.  
  4822. stringinfo dc.l 0,0
  4823.     dc.w 0,11,0,0,0,10,0,0
  4824.     dc.l 0,0,0
  4825.  
  4826. moregadget dc.l 0
  4827.     dc.w 70
  4828. y7    dc.w 226,80,9
  4829.     dc.w 0,$0001,$0001    * RELVERIFY,BOOLGADGET
  4830.     dc.l boxit,0,more,0,0
  4831.     dc.w 1,0,0
  4832.  
  4833. cancelgadget dc.l 0
  4834.     dc.w 490
  4835. y8    dc.w 226,80,9
  4836.     dc.w 0,$0001,$0001    * RELVERIFY,BOOLGADGET
  4837.     dc.l boxit,0,cancel,0,0
  4838.     dc.w 2,0,0
  4839.  
  4840.  
  4841. rleft    equ 181
  4842. rtop    equ 90
  4843. rwidth    equ 278
  4844. rhite    equ 82
  4845.  
  4846. highreq    dc.l 0
  4847.     dc.w rleft,rtop,rwidth,rhite,0,0
  4848.     dc.l textgadget
  4849.     dc.l box2
  4850.     dc.l reqtext1
  4851.     dc.w 0
  4852.     dc.b 1,0
  4853.     dc.l 0
  4854.     ds.b 32
  4855.     dc.l 0,0
  4856.     ds.b 36
  4857.  
  4858. fleft    equ 171
  4859. ftop    equ 90
  4860. fwidth    equ 298
  4861. fhite    equ 62
  4862.  
  4863.  
  4864. welldonereq dc.l 0
  4865.     dc.w fleft,ftop,fwidth,fhite,0,0
  4866.     dc.l 0
  4867.     dc.l boxA
  4868.     dc.l welldone1
  4869.     dc.w 0
  4870.     dc.b 1,0
  4871.     dc.l 0
  4872.     ds.b 32
  4873.     dc.l 0,0
  4874.     ds.b 36
  4875.  
  4876. iorequest dc.l 0,0
  4877.     dc.b 5,127
  4878.     dc.l 0
  4879.  
  4880.     dc.l replyport
  4881.     dc.w 0
  4882.  
  4883.     dc.l 0,0
  4884.     dc.w 0
  4885.     dc.b 0,0
  4886.  
  4887.     dc.w 0
  4888.     dc.l data
  4889.     dc.l 4
  4890.     dc.w 0,0,0
  4891.     ds.b $14
  4892.  
  4893. data    dc.b 3,5,10,12
  4894.  
  4895. replyport dc.l 0,0
  4896.     dc.b 4,0
  4897.     dc.l 0
  4898.  
  4899.     dc.b 0
  4900. signal    dc.b 0
  4901. task    dc.l 0
  4902.  
  4903. first    dc.l next
  4904. next    dc.l 0
  4905.     dc.l first
  4906.     dc.b 0,0
  4907.     
  4908.     even
  4909.  
  4910. hiscores
  4911.     dc.b " 1st ** Pete **",0,$2c,$b9
  4912.     dc.b " 2nd Chris     ",0,$1f,$e9
  4913.     dc.b " 3rd Mac.A     ",0,$0d,$91
  4914.     dc.b " 4th Plake     ",0,$09,$70
  4915.     dc.b " 5th Mike.T    ",0,$06,$73
  4916.     dc.b " 6th Moguls    ",0,$05,$bd
  4917.     dc.b " 7th Arnie     ",0,$05,$6e
  4918.     dc.b " 8th Lloydy    ",0,$04,$e2
  4919.     dc.b " 9th Ruthie    ",0,$03,$d9
  4920.     dc.b "10th Michaela  ",0,$02,$86
  4921.     dc.b "11th Rich      ",0,$02,$18
  4922.     dc.b "12th Farmerama ",0,$01,$ee
  4923.     dc.b "13th Helmet    ",0,$01,$8b
  4924.     dc.b "14th Brian     ",0,$01,$1b
  4925.     dc.b "15th Monster   ",0,$00,$7f
  4926.     ds.b 30
  4927.  
  4928.  
  4929.  
  4930. lastscr    dc.b "Last score "
  4931. lastscr2 dc.b "0",0,0,0,0,0,0
  4932.  
  4933. gamespld dc.b "Games played "
  4934. gamespld2 dc.b "0",0,0,0,0,0,0
  4935.  
  4936. loadbuffer ds.l 3
  4937. name1    dc.b "Klondike",0
  4938. name2    dc.b "Game",0
  4939. name3    dc.b "Options",0
  4940. name4    dc.b "Help!",0
  4941.  
  4942. text1    dc.b "About",0
  4943. text1b    dc.b "Versions",0
  4944. text1c    dc.b "Credits",0
  4945. text2    dc.b "Quit",0
  4946. text3    dc.b "New game",0
  4947. text4    dc.b "End game",0
  4948. text5    dc.b "  Colour monitor",0
  4949. text6    dc.b "  Mono monitor",0
  4950. text6b    dc.b "  Reset Hi-Scores",0
  4951. text6c    dc.b " Sure ? ",0
  4952. text6d    dc.b "  Merge Hi-Scores",0
  4953. text6e    dc.b "  PAL",0
  4954. text6f    dc.b "  NTSC",0
  4955. text6g    dc.b "  Face Graphics",0
  4956. text6h    dc.b "  Back Graphics",0
  4957. text6i    dc.b "  Symbol Graphics",0
  4958. text7    dc.b "Klondike rules",0
  4959. text8    dc.b "Playing the game",0
  4960. text9    dc.b "Scoring",0
  4961. text9b    dc.b "Hi-Score merging",0
  4962. text10    dc.b "Klondike Champions",0
  4963. text11    dc.b "G R E A T   S C O R E",0
  4964. text12    dc.b "Please type your name",0
  4965. text13    dc.b "N I C E   O N E   ! !",0
  4966. text14    dc.b "Time taken = "
  4967. time    ds.b 12
  4968. text15    dc.b "Bonus = "
  4969. bonus    ds.b 7
  4970. text16    dc.b "  More  ",0
  4971. text17    dc.b " Cancel ",0
  4972. text18    dc.b "  Done  ",0
  4973. mtextA    dc.b "** Merge Hi-Scores **",0
  4974. mtextB    dc.b " Location of ",34,"Hi-Scores",34," file : ",0
  4975. mtextC    dc.b "                                ",0
  4976. mergename dc.b "df0:Klondike",0
  4977.     ds.b 38        * 50-length of above text
  4978. mtextD    dc.b "    Searching....   ",0
  4979. mtextE    dc.b "Can't find directory",0
  4980. mtextF    dc.b "  Can't find file   ",0
  4981. mtextG    dc.b "     Found file     ",0
  4982. mtextH    dc.b "Insert disk containing Hi-Scores",0
  4983. mtextI    dc.b "   PANIC   ",0
  4984. mtextJ    dc.b " Done it ! ",0
  4985. mtextK    dc.b "  Merge !  ",0
  4986. mtextL    dc.b " Give up ! ",0
  4987. mtextM    dc.b "  Cancel!  ",0
  4988. mtextN    dc.b "Aaaargh Read Error !",0
  4989. mtextO    dc.b "   Retry   ",0
  4990. mtextP    dc.b "Replace original Klondike disk !",0
  4991. mtextQ    dc.b "Merging is complete !",0
  4992.  
  4993. fontype dc.b "topaz.font",0
  4994. wndtitle dc.b "         ** Klondike Version 1.3 - Written by Peter Wiseman (C) 1992 **",0
  4995. scoretext dc.b "Score "
  4996. storage    ds.b 12
  4997.  
  4998. dosname dc.b "dos.library",0
  4999. intname dc.b "intuition.library",0
  5000. grafname dc.b "graphics.library",0
  5001.  
  5002. device    dc.b "audio.device",0
  5003. filename1 dc.b "CardGraphics",0
  5004. filename2 dc.b "Hi-Scores",0
  5005. filename3 dc.b "Sounds",0
  5006. facedir    dc.b "Card Faces",0
  5007. backdir    dc.b "Card Backs",0
  5008. symbolsdir dc.b "Card Symbols",0
  5009.  
  5010. helptext1    
  5011.     dc.b 32,0,"                *****   K L O N D I K E   R U L E S   ***** ",0,32,0
  5012.     dc.b "      Games of patience are known in  America as  solitaires, a "
  5013.     dc.b "much better name, as they are meant to be played by a single player."
  5014.     dc.b " There are hundreds of different games of  card patience.  One of the "
  5015.     dc.b "most popular is Klondike, so much so that to most people the word "
  5016.     dc.b "patience means Klondike. ",0,32,0
  5017.     dc.b "      The game is played  with a standard pack of 52 cards.  A row of seven "
  5018.     dc.b "cards is dealt face down followed by a row of six, five and so on "
  5019.     dc.b "producing seven columns consisting of one , two , three , four , five , "
  5020.     dc.b "six and seven cards.  The top card in each column is turned face up, "
  5021.     dc.b "the rest remain face down. These 28 cards make up what is known "
  5022.     dc.b "as the tableau. ",0,0
  5023.     dc.b "      The game now commences.  Any face up aces are placed  somewhere"
  5024.     dc.b " above the tableau to form the  foundations.  Foundations are built "
  5025.     dc.b "on by cards of ascending value  and of similar suits.  For example "
  5026.     dc.b " once the ace of hearts has been placed above the tableau as a "
  5027.     dc.b "foundation  the two of hearts can be placed on top of it if available "
  5028.     dc.b "followed by the three of hearts and so on. The game is won  if all "
  5029.     dc.b "four foundations  are built up to their  respective suits kings. ",0,32,0
  5030.  
  5031.     dc.b "     There are two ways in which cards can be moved from the tableau. "
  5032.     dc.b "First the lowest face up card in each of the seven columns can be played "
  5033.     dc.b "onto the foundations or "
  5034.     dc.b "to another column  creating a series of alternating  colours and decreasing "
  5035.     dc.b "values. For examples a six of hearts or diamonds (red suits) can be "
  5036.     dc.b "placed on a seven of spades or clubs (black suits)  or a black queen "
  5037.     dc.b "can be played onto a red king. Secondly a whole column of face up cards "
  5038.     dc.b "can by moved as a single unit providing its destination column retains "
  5039.     dc.b "its red, black, red ascending values sequence.  Face down tableau "
  5040.     dc.b "cards uncovered by  movement of a single card or column  are turned face up."
  5041.     dc.b "  Kings or columns headed by kings can be moved into empty columns. ",0,0
  5042.  
  5043.     dc.b "     When no more columns or single cards can be repositioned , three cards"
  5044.     dc.b " from the deck are turn face up onto a  ",34,"waste pile",34,".  The uppermost card of" 
  5045.     dc.b " this pile may be  played onto the  tableau  or  foundations making the card"
  5046.     dc.b " below available.  Another three cards are turned over from the deck when no"
  5047.     dc.b " more cards can be played followed by another three  until the deck has been"
  5048.     dc.b " passed.   At this point the whole  ",34,"waste pile",34,"  is turned over and redealt"
  5049.     dc.b " three at a time. ",0,32,0
  5050.  
  5051.     dc.b "   The game is over when the deck has been passed without playing a card."
  5052.  
  5053.     dc.b 32,0,0,0
  5054.  
  5055. helptext2 dc.b 254,0,"              *****   P L A Y I N G   T H E   G A M E   ***** ",0,32,0
  5056.     dc.b "    To start the game press the right mouse button and select NEW GAME from"
  5057.     dc.b " the GAME menu.  The pack will then be shuffled and  28 cards  dealt to form"
  5058.     dc.b " the tableau.  The rest of the pack is displayed face down above the tableau"
  5059.     dc.b " with outlines of the empty foundations to either side. ",0,32,0
  5060.     
  5061.     dc.b "    Amiga  Klondike  is entirely mouse controlled  resulting in a very fast"
  5062.     dc.b " and user-friendly method of moving cards.   This is achieved by positioning"
  5063.     dc.b " the pointer over a card , pressing the left mouse button and whilst keeping"
  5064.     dc.b " the button pressed the card can be dragged around the screen. When the card"
  5065.     dc.b " touches a valid destination it is highlighted in grey  and on releasing the"
  5066.     dc.b " mouse button the card is repositioned.If you are dragging a card and decide"
  5067.     dc.b " you don't  really want to move it  then find a position  where no cards are"
  5068.     dc.b " highlighted  and release the mouse button.  The card will then jump back to"
  5069.     dc.b " its original position. ",0,0
  5070.     dc.b 254,0,"    Whole columns may be moved  by clicking on the highest upturned card and"
  5071.     dc.b " dragging.  Any face down  tableau cards  revealed by moving other cards are"
  5072.     dc.b " turned over by clicking on them once.Clicking is also used to turn the next"
  5073.     dc.b " three cards in the deck or to redeal after each pass. ",0,32,0
  5074.  
  5075.     dc.b "    If you are still unsure about the rules of Klondike then the best thing"
  5076.     dc.b " to do is simply start up a new game. The computer won't let you do anything"
  5077.     dc.b " illegal so you'll soon get the hang of how to play. Refer to the HELP menus"
  5078.     dc.b " if you're unsure about anything. ",0,32,0
  5079.     dc.b "    Unlike normal Klondike , Amiga Klondike is played against the clock. As"
  5080.     dc.b " the seconds tick by your score decreases. The bonus awarded for a completed"
  5081.     dc.b " game is also based on the time taken resulting in more skill being required"
  5082.     dc.b " as you race against the clock.  When you decide  that no more cards  can be" 
  5083.     dc.b " played you must select  END GAME  from under the  GAME menu as the computer" 
  5084.     dc.b " can't make this decision for you.  Enjoy playing Klondike ! ",0,0,0
  5085.  
  5086. helptext3 dc.b 254,0,"                      *****   S C O R I N G   ***** ",0,32,0
  5087.     dc.b "Turning over a face down tableau card ........  + 25 Points  ( Max = 525 )"
  5088.     dc.b " Playing a card from the deck to tableau ......  + 45 Points  ( Max = 1080 )"
  5089.     dc.b " Adding a card to the foundations .............  + 60 Points  ( Max = 3120 ) ",0,254,0,32,0
  5090.     dc.b "Every second of elapsed time .................................   - 1 Point"
  5091.     dc.b " Moving one card from a face up column to another column ......  - 25 Points"
  5092.     dc.b " Moving a foundation card back to the tableau .................  - 75 Points"
  5093.     dc.b " Each pass through the deck after the third pass .............. - 125 Points ",0,254,0,32,0
  5094.  
  5095.     dc.b "If the game is completed , a bonus is calculated in the following way : ",0,32,0
  5096.     dc.b "Bonus = [ End of game score - ( Time taken * 5 ) ] * 2 ",0,32,0
  5097.     dc.b "Since the maximum end of game score possible is 4725 then assuming no time"
  5098.     dc.b " was taken , the largest bonus would be 9450 ! ",0,0,0
  5099.  
  5100. helptext4    
  5101.     dc.b 254,0,"             *****   M E R G I N G   H I - S C O R E S   ***** ",0,254,0,32,0
  5102.     dc.b "    To increase the playability of Klondike a ",34,"Merge Hi-Scores",34," feature has ",0
  5103.     dc.b " been added. This enables scores saved on another disk ( eg a friend's ) to ",0
  5104.     dc.b " be merged into your own hi-score table. ",0,32,0
  5105.     dc.b " The proceedure is quite simple : ",0,32,0
  5106.     dc.b "    [1] Select ",34,"MERGE HI-SCORES",34," from under the ",34,"OPTIONS",34," menu. ",0
  5107.     dc.b "    [2] Replace your Klondike disk with a friends Klondike disk. ",0
  5108.     dc.b "    [3] Click in the ",34,"Done it",34," box. ",0
  5109.     dc.b "    [4] The computer will attempt to load the ",34,"Hi-Scores",34," file and if ",0
  5110.     dc.b "        successful will prompt you to select the ",34,"MERGE",34," box to proceed. ",0
  5111.     dc.b "    [5] Replace your Klondike disk so the new hi-score table can be saved. ",0,32,0
  5112.     dc.b " The above assumes the  ",34,"Hi-Scores",34,"  file to be merged  is located in its ",0
  5113.     dc.b " usual directory ",34,"df0:Klondike",34,". If not you will have to edit the textbox ",0
  5114.     dc.b " to let the computer know where it is located. ",0,0,0
  5115.  
  5116. versionstext
  5117.     dc.b 32,0,254,0,"             *****   K L O N D I K E   V E R S I O N S   ***** ",0,32,0,32,0
  5118.     dc.b 254,0,"V1.0  : The first complete version of Klondike. I only had 1/2 meg then and ",0
  5119.     dc.b "        was soon informed that this version didn't work on expanded Amigas. ",0,32,0
  5120.     dc.b "V1.1  : Modified to work on expanded Amigas. ",0,32,0
  5121.     dc.b "V1.1b : All relevent files are now in the ",34,"Klondike",34," directory (No need for ",0
  5122.     dc.b "        Xicon, Run, EndCli etc in the 'C' directory).  The program searches ",0
  5123.     dc.b "        for files in its own  directory  so there is no need to use ASSIGN. ",0
  5124.     dc.b "        ",34,"Clear Hi-Scores",34," menu and "
  5125.     dc.b 34,"number of games played",34,"  feature added. ",0
  5126.     dc.b "        Minor bug fixed to prevent a column being placed on the foundations ",0,32,0
  5127.     dc.b "V1.1c : NTSC option added for USA. Credits menu added. ",0,0
  5128.     dc.b 32,0,32,0,"V1.2  : ",34,"Merge Hi-Scores",34," menu with Help page and this screen added. ",0
  5129.     dc.b "        A new Hi-Score of 11449 to beat (Genuine , honest !) ",0,32,0
  5130.     dc.b "V1.21 : Bug fixed occurring in V1.2 that caused the game to crash ",0
  5131.     dc.b "        occasionally on completing the game. ",0,32,0
  5132.     dc.b "V1.22 : Jerky card movement, when booting from my hard drive, fixed. ",0,32,0
  5133.     dc.b "V1.3  : Options to load different card graphics added. ",0,32,0,32,0
  5134.     dc.b "              Latest version released on 3rd September 1992. ",0,0,0 
  5135.  
  5136.  
  5137.  
  5138. creditstext dc.b 254,0,254,0,"                       *****   C R E D I T S   ***** ",0,32,0,254,0
  5139.     dc.b "      The Amiga versions of Klondike were written by : ",0,32,0
  5140.     dc.b "                       Peter Wiseman, ",0
  5141.     dc.b "                        30 Coronation Drive, ",0
  5142.     dc.b "                         Penketh, ",0
  5143.     dc.b "                          Warrington, ",0
  5144.     dc.b "                           Cheshire, ",0
  5145.     dc.b "                            WA5 2DD, ",0
  5146.     dc.b "                             ENGLAND. ",0,32,0,254,0
  5147.     dc.b "      Special thanks go to Michael Casteel of SunnyVale, California for ",0
  5148.     dc.b "      the idea from his shareware version of Klondike on the Apple Mac. ",0,32,0
  5149.     dc.b "      Dankeschoen to Tobias Ferber from Baden-Baden, Germany for his ",0
  5150.     dc.b "      card graphics and inspiring the modifications in version 1.3. ",0,0,0
  5151.  
  5152.  
  5153. abouttext
  5154.     dc.b 32,0,"        Klondike was written by Peter Wiseman a poor , penniless student ",0
  5155.     dc.b "   his feeble grant spent , beer glass empty  and in desperate need of a ",0
  5156.     dc.b "   few notes.So if you like this game then please show your appreciation ",0
  5157.     dc.b "   by sending a small donation to the  ",34,"Help a Skint Student Fund",34," whose ",0
  5158.     dc.b "   address will be revealed below , and maybe I'll be motivated to write ",0
  5159.     dc.b "   some more stunning Amiga programs.   Any amount will help remedy this ",0
  5160.     dc.b "   pitiful situation: one pound, five pounds; foreign currency will also ",0
  5161.     dc.b "   be gratefully received  and in  return  I'll have a really wild night ",0
  5162.     dc.b "   out !   I'll also send you some PD software and any new card graphics ",0
  5163.     dc.b "   that I have, including the stunning ",34,"Lemmings",34," card set. ",0
  5164.     dc.b "   Please tell the truck driver carrying your wads of dosh to deliver to ",0,32,0
  5165.     dc.b "   30 Coronation Drive, Penketh, Warrington, Cheshire, WA5 2DD, England. ",0,255,32,0
  5166.     dc.b "   If you don't like this game then you bloody well should do.  I didn't ",0
  5167.     dc.b "   spend all those hundreds of hours trying to understand the garbage in ",0
  5168.     dc.b "   over a hundred quids worth of  Rom Kernal  Manuals  so you could moan ",0
  5169.     dc.b "   about how you dont like card games and prefer a good game of Kick Off ",0
  5170.     dc.b "   So how about it ?  Go on , dig deep and be generous ..... ",0,32,0
  5171.     dc.b "                                            ..... Signed Pete the Scav. ",0,0,0
  5172.  
  5173. message    dc.b "                     H.M. GOVERNMENT HEALTH WARNING ! : ",0
  5174.     dc.b "                KLONDIKE CAN SERIOUSLY DAMAGE YOUR HEALTH ! ",0,32,0
  5175. message2 dc.b "ADDICTION (a'-dikt-shon) n. the condition of being abnormally dependent on ",0
  5176.     dc.b "some habit  esp. compulsive  dependency on computer  card games written by ",0
  5177.     dc.b "poor skint students. ",0,32,0
  5178.     dc.b "   The author is aware of the dangerously high level of addiction Klondike ",0
  5179. guilty1    dc.b "can cause in certain susceptible individuals and has noticed that            ",0
  5180.     dc.b "is rapidly approaching a state of hopeless addiction ! ",0,254,0
  5181.     dc.b "   Governent Health Officials  have traced the permanent hi-score table to ",0
  5182.     dc.b "be responsible for this  desperate  situation  and as a result it has been ",0
  5183.     dc.b "removed from view.  This may cause an initial feeling  of emptiness but it ",0
  5184. guilty2    dc.b "is for your own good             ",0
  5185.     dc.b "   Sweaty palms,sulking,digging out old packs of playing cards and frantic ",0
  5186.     dc.b "pawing at the screen mumbling ",34,"Just one more go",34,"  are all classic klondike ",0
  5187.     dc.b "withdrawal symptoms. If any of these persist for more than three days then ",0
  5188.     dc.b "you will need to seek help from Klondikers Anonymous. Send donations to : ",0,32,0
  5189.     dc.b "PETER WISEMAN : 30 CORONATION DRIVE, PENKETH, WARRINGTON, WA5 2DD, ENGLAND ",0,32,0
  5190.     dc.b "and in return  you will  receive the full game which  doesn't include this ",0 
  5191.     dc.b "annoying message and you can play to your heart's content ! ",0,0,0,0
  5192.  
  5193.  
  5194.